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

Method __init__

PySimpleGUI/PySimpleGUI.py:4471–4539  ·  view source on GitHub ↗

:param text: Text that is to be displayed in the widget :type text: (str) :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 :type size: (int, in

(self, text, size=(None, None), s=(None, None), auto_size_text=None, click_submits=None, enable_events=False,
                 relief=RELIEF_SUNKEN, font=None, text_color=None, background_color=None, justification=None, pad=None, p=None,
                 key=None, k=None, right_click_menu=None, expand_x=False, expand_y=False, tooltip=None, visible=True, metadata=None)

Source from the content-addressed store, hash-verified

4469 """
4470
4471 def __init__(self, text, size=(None, None), s=(None, None), auto_size_text=None, click_submits=None, enable_events=False,
4472 relief=RELIEF_SUNKEN, font=None, text_color=None, background_color=None, justification=None, pad=None, p=None,
4473 key=None, k=None, right_click_menu=None, expand_x=False, expand_y=False, tooltip=None, visible=True, metadata=None):
4474 """
4475 :param text: Text that is to be displayed in the widget
4476 :type text: (str)
4477 :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
4478 :type size: (int, int) | (int, None) | int
4479 :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
4480 :type s: (int, int) | (None, None) | int
4481 :param auto_size_text: True if size should fit the text length
4482 :type auto_size_text: (bool)
4483 :param click_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
4484 :type click_submits: (bool)
4485 :param enable_events: Turns on the element specific events. StatusBar events occur when the bar is clicked
4486 :type enable_events: (bool)
4487 :param relief: relief style. Values are same as progress meter relief values. Can be a constant or a string: `RELIEF_RAISED RELIEF_SUNKEN RELIEF_FLAT RELIEF_RIDGE RELIEF_GROOVE RELIEF_SOLID`
4488 :type relief: (str)
4489 :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
4490 :type font: (str or (str, int[, str]) or None)
4491 :param text_color: color of the text
4492 :type text_color: (str)
4493 :param background_color: color of background
4494 :type background_color: (str)
4495 :param justification: how string should be aligned within space provided by size. Valid choices = `left`, `right`, `center`
4496 :type justification: (str)
4497 :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)
4498 :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
4499 :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
4500 :type p: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
4501 :param key: Used with window.find_element and with return values to uniquely identify this element to uniquely identify this element
4502 :type key: str | int | tuple | object
4503 :param k: Same as the Key. You can use either k or key. Which ever is set will be used.
4504 :type k: str | int | tuple | object
4505 :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.
4506 :type right_click_menu: List[List[ List[str] | str ]]
4507 :param expand_x: If True the element will automatically expand in the X direction to fill available space
4508 :type expand_x: (bool)
4509 :param expand_y: If True the element will automatically expand in the Y direction to fill available space
4510 :type expand_y: (bool)
4511 :param tooltip: text, that will appear when mouse hovers over the element
4512 :type tooltip: (str)
4513 :param visible: set visibility state of the element
4514 :type visible: (bool)
4515 :param metadata: User metadata that can be set to ANYTHING
4516 :type metadata: (Any)
4517 """
4518
4519 self.DisplayText = text
4520 self.TextColor = text_color if text_color else DEFAULT_TEXT_COLOR
4521 self.Justification = justification
4522 self.Relief = relief
4523 self.ClickSubmits = click_submits or enable_events
4524 if background_color is None:
4525 bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR
4526 else:
4527 bg = background_color
4528 self.TKText = self.Widget = None # type: tk.Label

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected