MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / Text

Class Text

PySimpleGUI/PySimpleGUI.py:4107–4454  ·  view source on GitHub ↗

Text - Display some text in the window. Usually this means a single line of text. However, the text can also be multiple lines. If multi-lined there are no scroll bars.

Source from the content-addressed store, hash-verified

4105# Text #
4106# ---------------------------------------------------------------------- #
4107class Text(Element):
4108 """
4109 Text - Display some text in the window. Usually this means a single line of text. However, the text can also be multiple lines. If multi-lined there are no scroll bars.
4110 """
4111
4112 def __init__(self, text='', size=(None, None), s=(None, None), auto_size_text=None, click_submits=False, enable_events=False, relief=None, font=None,
4113 text_color=None, background_color=None, colors=(None,None), border_width=None, justification=None, pad=None, p=None, key=None, k=None, right_click_menu=None, expand_x=False,
4114 expand_y=False, grab=None, tooltip=None, visible=True, metadata=None):
4115 """
4116 :param text: The text to display. Can include /n to achieve multiple lines. Will convert (optional) parameter into a string
4117 :type text: Any
4118 :param size: (w, h) w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1
4119 :type size: (int, int) | (int, None) | (None, None) | (int, ) | int
4120 :param s: Same as size parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, size will be used
4121 :type s: (int, int) | (int, None) | (None, None) | (int, ) | int
4122 :param auto_size_text: if True size of the Text Element will be sized to fit the string provided in 'text' parm
4123 :type auto_size_text: (bool)
4124 :param click_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
4125 :type click_submits: (bool)
4126 :param enable_events: Turns on the element specific events. Text events happen when the text is clicked
4127 :type enable_events: (bool)
4128 :param relief: relief style around the text. Values are same as progress meter relief values. Should be a constant that is defined at starting with RELIEF - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID
4129 :type relief: (str)
4130 :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
4131 :type font: (str or (str, int[, str]) or None)
4132 :param text_color: color of the text
4133 :type text_color: (str)
4134 :param background_color: color of background
4135 :type background_color: (str)
4136 :param colors: Optional quick specification of both text and background colors in 1 parameter. If a single color specified, then assumed to be text_color
4137 :type colors: (str) or (str, str)
4138 :param border_width: number of pixels for the border (if using a relief)
4139 :type border_width: (int)
4140 :param justification: how string should be aligned within space provided by size. Valid choices = `left`, `right`, `center`
4141 :type justification: (str)
4142 :param pad: Amount of padding to put around element in pixels (left/right, top/bottom) or ((left, right), (top, bottom)) or an int. If an int, then it's converted into a tuple (int, int)
4143 :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
4144 :param p: Same as pad parameter. It's an alias. If EITHER of them are set, then the one that's set will be used. If BOTH are set, pad will be used
4145 :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
4146 :param key: Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element
4147 :type key: str or int or tuple or object
4148 :param k: Same as the Key. You can use either k or key. Which ever is set will be used.
4149 :type k: str | int | tuple | object
4150 :param right_click_menu: A list of lists of Menu items to show when this element is right clicked. See user docs for exact format.
4151 :type right_click_menu: List[List[ List[str] | str ]]
4152 :param expand_x: If True the element will automatically expand in the X direction to fill available space
4153 :type expand_x: (bool)
4154 :param expand_y: If True the element will automatically expand in the Y direction to fill available space
4155 :type expand_y: (bool)
4156 :param grab: If True can grab this element and move the window around. Default is False
4157 :type grab: (bool)
4158 :param tooltip: text, that will appear when mouse hovers over the element
4159 :type tooltip: (str)
4160 :param visible: set visibility state of the element
4161 :type visible: (bool)
4162 :param metadata: User metadata that can be set to ANYTHING
4163 :type metadata: (Any)
4164 """

Callers 15

PushFunction · 0.85
VPushFunction · 0.85
TitlebarFunction · 0.85
sample_layoutFunction · 0.85
theme_previewerFunction · 0.85
popupFunction · 0.85
popup_get_folderFunction · 0.85
popup_get_fileFunction · 0.85
popup_get_textFunction · 0.85
popup_get_dateFunction · 0.85
popup_animatedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected