Web Analytics Made Easy - Statcounter
Skip to content

Debug Window Output

easy_print

Works like a "print" statement but with windowing options. Routes output to the "Debug Window"

In addition to the normal text and background colors, you can use a "colors" tuple/string The "colors" or "c" parameter defines both the text and background in a single parm. It can be a tuple or a single single. Both text and background colors need to be specified colors -(str, str) or str. A combined text/background color definition in a single parameter c - (str, str) - Colors tuple has format (foreground, backgrouned) c - str - can also be a string of the format "foreground on background" ("white on red")

easy_print(
    args = *<1 or N objects>,
    size = (None, None),
    end = None,
    sep = None,
    location = (None, None),
    relative_location = (None, None),
    font = None,
    no_titlebar = False,
    no_button = False,
    grab_anywhere = False,
    keep_on_top = None,
    do_not_reroute_stdout = True,
    echo_stdout = False,
    text_color = None,
    background_color = None,
    colors = None,
    c = None,
    erase_all = False,
    resizable = True,
    blocking = None,
    wait = None
)

Parameter Descriptions

Name Type Default Description
*args Any stuff to output
background_color str None color of background
blocking (bool or None) None if True, makes the window block instead of returning immediately. The "Quit" button changers to "More"
c str or str, str None Either a tuple or a string that has both the text and background colors
colors str or str, str None Either a tuple or a string that has both the text and background colors
do_not_reroute_stdout bool True do not reroute stdout and stderr. If False, both stdout and stderr will reroute to here
echo_stdout bool False If True stdout is sent to both the console and the debug window
end str None end character
erase_all bool False If True when erase the output before printing
font (str or (str, int[, str]) or None) None specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
grab_anywhere bool False If True: can grab anywhere to move the window (Default = False)
keep_on_top bool None If True the window will remain above all current windows
location (int, int) (None, None) Location of upper left corner of the window
location (int, int) (None, None) Location of upper left corner of the window
no_button bool False don't show button
no_titlebar bool False If True no titlebar will be shown
relative_location (int, int) (None, None) (x,y) location relative to the default location of the window, in pixels. Normally the window centers. This location is relative to the location the window would be created. Note they can be negative.
resizable bool True if True, the user can resize the debug window. Default is True
sep str None separator character
size (int, int) (None, None) (w,h) w=characters-wide, h=rows-high
text_color str None color of the text
wait (bool or None) None Same as the "blocking" parm. It's an alias. if True, makes the window block instead of returning immediately. The "Quit" button changes to "Click to Continue..."

easy_print_close

Close a previously opened EasyPrint window

easy_print_close()

eprint

This method is an alias for easy_print

sgprint

This method is an alias for easy_print

sgprint_close

This method is an alias for easy_print_close

Color Printing to Multiline Element of a Window

cprint

Color print to a multiline element in a window of your choice. Must have EITHER called cprint_set_output_destination prior to making this call so that the window and element key can be saved and used here to route the output, OR used the window and key parameters to the cprint function to specicy these items.

args is a variable number of things you want to print.

end - The end char to use just like print uses sep - The separation character like print uses text_color - The color of the text key - overrides the previously defined Multiline key window - overrides the previously defined window to output to background_color - The color of the background colors -(str, str) or str. A combined text/background color definition in a single parameter

There are also "aliases" for text_color, background_color and colors (t, b, c) t - An alias for color of the text (makes for shorter calls) b - An alias for the background_color parameter c - (str, str) - "shorthand" way of specifying color. (foreground, backgrouned) c - str - can also be a string of the format "foreground on background" ("white on red")

With the 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='white', background_color='red') cprint('This will print white text on red background', t='white', b='red')

cprint(
    args = *<1 or N objects>,
    end = None,
    sep = " ",
    text_color = None,
    font = None,
    t = None,
    background_color = None,
    b = None,
    colors = None,
    c = None,
    window = None,
    key = None,
    justification = None,
    autoscroll = True,
    erase_all = False
)

Parameter Descriptions

Name Type Default Description
*args Any stuff to output
autoscroll bool True If True the contents of the element will automatically scroll as more data added to the end
b str None The background color of the line
background_color str None The background color of the line
c str or str, str None Either a tuple or a string. Same as the color parm
colors str or str, str None Either a tuple or a string that has both the text and background colors "text on background" or just the text color
end str None end character
font (str or (str, int[, str]) or None) None specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike for the value being updated
justification str None text justification. left, right, center. Can use single characters l, r, c. Sets only for this value, not entire element
key Any None key of multiline to output to (if you want to override the one previously set)
sep str separator character
t str None Color of the text
text_color str None Color of the text
window Window None Window containing the multiline to output to (if you want to override the one previously set)

cprint_set_output_destination

Sets up the color print (cprint) output destination

cprint_set_output_destination(
    window,
    multiline_key
)

Parameter Descriptions

Name Type Default Description
multiline_key Any Key for the Multiline Element where output will be sent
window Window The window that the cprint call will route the output to
RETURN None None