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

Method __init__

PySimpleGUI/PySimpleGUI.py:959–1125  ·  view source on GitHub ↗

Element base class. Only used internally. User will not create an Element object by itself :param type: The type of element. These constants all start with "ELEM_TYPE_" :type type: (int) (could be enum) :param size:

(self, type, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None,
                 visible=True, metadata=None, sbar_trough_color=None, sbar_background_color=None, sbar_arrow_color=None, sbar_width=None, sbar_arrow_width=None, sbar_frame_color=None, sbar_relief=None)

Source from the content-addressed store, hash-verified

957 """ The base class for all Elements. Holds the basic description of an Element like size and colors """
958
959 def __init__(self, type, size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None,
960 visible=True, metadata=None, sbar_trough_color=None, sbar_background_color=None, sbar_arrow_color=None, sbar_width=None, sbar_arrow_width=None, sbar_frame_color=None, sbar_relief=None):
961 """
962 Element base class. Only used internally. User will not create an Element object by itself
963
964 :param type: The type of element. These constants all start with "ELEM_TYPE_"
965 :type type: (int) (could be enum)
966 :param size: w=characters-wide, h=rows-high. If an int instead of a tuple is supplied, then height is auto-set to 1
967 :type size: (int, int) | (None, None) | int
968 :param auto_size_text: True if the Widget should be shrunk to exactly fit the number of chars to show
969 :type auto_size_text: bool
970 :param font: specifies the font family, size. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike
971 :type font: (str or (str, int[, str]) or None)
972 :param background_color: color of background. Can be in #RRGGBB format or a color name "black"
973 :type background_color: (str)
974 :param text_color: element's text color. Can be in #RRGGBB format or a color name "black"
975 :type text_color: (str)
976 :param key: Identifies an Element. Should be UNIQUE to this window.
977 :type key: str | int | tuple | object
978 :param pad: Amount of padding to put around element in pixels (left/right, top/bottom). If an int is given, then auto-converted to tuple (int, int)
979 :type pad: (int, int) or ((int, int),(int,int)) or (int,(int,int)) or ((int, int),int) | int
980 :param tooltip: text, that will appear when mouse hovers over the element
981 :type tooltip: (str)
982 :param visible: set visibility state of the element (Default = True)
983 :type visible: (bool)
984 :param metadata: User metadata that can be set to ANYTHING
985 :type metadata: (Any)
986 :param sbar_trough_color: Scrollbar color of the trough
987 :type sbar_trough_color: (str)
988 :param sbar_background_color: Scrollbar color of the background of the arrow buttons at the ends AND the color of the "thumb" (the thing you grab and slide). Switches to arrow color when mouse is over
989 :type sbar_background_color: (str)
990 :param sbar_arrow_color: Scrollbar color of the arrow at the ends of the scrollbar (it looks like a button). Switches to background color when mouse is over
991 :type sbar_arrow_color: (str)
992 :param sbar_width: Scrollbar width in pixels
993 :type sbar_width: (int)
994 :param sbar_arrow_width: Scrollbar width of the arrow on the scrollbar. It will potentially impact the overall width of the scrollbar
995 :type sbar_arrow_width: (int)
996 :param sbar_frame_color: Scrollbar Color of frame around scrollbar (available only on some ttk themes)
997 :type sbar_frame_color: (str)
998 :param sbar_relief: Scrollbar relief that will be used for the "thumb" of the scrollbar (the thing you grab that slides). Should be a constant that is defined at starting with "RELIEF_" - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID
999 :type sbar_relief: (str)
1000 """
1001
1002 if size is not None and size != (None, None):
1003 if isinstance(size, int):
1004 size = (size, 1)
1005 if isinstance(size, tuple) and len(size) == 1:
1006 size = (size[0], 1)
1007
1008 if pad is not None and pad != (None, None):
1009 if isinstance(pad, int):
1010 pad = (pad, pad)
1011
1012 self.Size = size
1013 self.Type = type
1014 self.AutoSizeText = auto_size_text
1015
1016 self.Pad = pad

Callers

nothing calls this directly

Calls 2

TTKPartOverridesClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected