Skip to content

Line breaks are not being preserved #59

Description

@PySimpleGUI

When I look at read the docs, the description is losing the line breaks.

A new function cprint is an excellent example.

Here's the code:

def cprint(*args, **kwargs):
    """
    Color print to a multiline element in a window of your choice.
    Must have called cprint_set_output_destination prior ot making this call so that the
    window and element key can be saved and used here to route the output
    kwargs can be any of these keywords:
        end - The end char to use just like print uses
        sep - The separation character like print uses
        text_color - The color of the text
        t - An alias for color of the text (makes for shorter calls)
        background_color - The color of the background
        b - An alias for the background_color parameter
        c - Tuple[str, str] - "shorthand" way of specifying color. (foreground, backgrouned)
            str - can also be a string of the format "foreground on background"  ("white on red")
    With these aliases it's possible to write the same print but in more compact ways:
    cprint('This will print white text on red background', c=('white', 'red'))
    cprint('This will print white text on red background', c='white on red')
    cprint('This will print white text on red background', text_color='red', background_color='white')
    cprint('This will print white text on red background', t='red', b='white')

    :param *args: stuff to output
    :type *args: (Any)
    :param text_color: Color of the text
    :type text_color: (str)
    :param background_color: The background color of the line
    :type background_color: (str)
    :param t: Color of the text
    :type t: (str)
    :param b: The background color of the line
    :type b: (str)
    :param b: The background color of the line
    :type b: (str)
    :param c: Either a tuple or a string that has both the text and background colors
    :type c: (str) or Tuple[str, str]
    :param end: end character
    :type end: (str)
    :param sep: separator character
    :type sep: (str)
    :return:
    :rtype:
    """

And this is what's rendered on ReadTheDocs

https://pysimplegui.readthedocs.io/en/latest/call%20reference/#color-printing-to-multiline-element-of-a-window

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions