Merge pull request #2675 from PySimpleGUI/Dev-latest

fix for missing padding on invisible elems, STARTED lots of docstring…
This commit is contained in:
PySimpleGUI 2020-03-05 08:35:58 -05:00 committed by GitHub
commit 6532e78ee6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 375 additions and 213 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.16.7 Unreleased\n update_animation_no_buffering, popup_notify, removed TRANSPARENT_BUTTON, TabGroup now autonumbers keys, Table col width better size based on font, Table measure row height, Upgrade from GitHub utility (experimental), Multiline.print" version = __version__ = "4.16.8 Unreleased\n update_animation_no_buffering, popup_notify, removed TRANSPARENT_BUTTON, TabGroup now autonumbers keys, Table col width better size based on font, Table measure row height, Upgrade from GitHub utility (experimental), Multiline.print, fix padding lost with visibility"
port = 'PySimpleGUI' port = 'PySimpleGUI'
@ -478,11 +478,12 @@ class ToolTip:
def __init__(self, widget, text, timeout=DEFAULT_TOOLTIP_TIME): def __init__(self, widget, text, timeout=DEFAULT_TOOLTIP_TIME):
""" """
:param widget: The tkinter widget
:param widget: (widget type varies) The tkinter widget :type widget: widget type varies
:param text: (str) text for the tooltip. It can inslude \n :param text: text for the tooltip. It can inslude \n
:param timeout: (int) Time in milliseconds that mouse must remain still before tip is shown :type text: str
:param timeout: Time in milliseconds that mouse must remain still before tip is shown
:type timeout: int
""" """
self.widget = widget self.widget = widget
self.text = text self.text = text
@ -576,17 +577,28 @@ class Element():
""" """
Element base class. Only used internally. User will not create an Element object by itself Element base class. Only used internally. User will not create an Element object by itself
:param type: (int) (could be enum) The type of element. These constants all start with "ELEM_TYPE_" :param type: The type of element. These constants all start with "ELEM_TYPE_"
:param size: Tuple[int, int] (width ,height ) w=characters-wide, h=rows-high :type type: (int) (could be enum)
:param auto_size_text: (bool) True if the Widget should be shrunk to exactly fit the number of chars to show :param size: w=characters-wide, h=rows-high
:param font: Union[str, Tuple[str, int]] specifies the font family, size, etc (see docs for exact formats) :type size: Tuple[int, int] (width, height)
:param background_color: (str) color of background. Can be in #RRGGBB format or a color name "black" :param auto_size_text: True if the Widget should be shrunk to exactly fit the number of chars to show
:param text_color: (str) element's text color. Can be in #RRGGBB format or a color name "black" :type auto_size_text: bool
:param key: (Any) Identifies an Element. Should be UNIQUE to this window. :param font: specifies the font family, size, etc (see docs for exact formats)
:param pad: (int, int) or ((int,int),(int,int)) Amount of padding to put around element in pixels (left/right, top/bottom) :type font: Union[str, Tuple[str, int]]
:param tooltip: (str) text, that will appear when mouse hovers over the element :param background_color: color of background. Can be in #RRGGBB format or a color name "black"
:param visible: (bool) set visibility state of the element (Default = True) :type background_color: (str)
:param metadata: (Any) User metadata that can be set to ANYTHING :param text_color: element's text color. Can be in #RRGGBB format or a color name "black"
:type text_color: (str)
:param key: Identifies an Element. Should be UNIQUE to this window.
:type key: (Any)
:param pad: Amount of padding to put around element in pixels (left/right, top/bottom)
:type pad: (int, int) or ((int,int),(int,int))
:param tooltip: text, that will appear when mouse hovers over the element
:type tooltip: (str)
:param visible: set visibility state of the element (Default = True)
:type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
:type metadata: Any
""" """
self.Size = size self.Size = size
self.Type = type self.Type = type
@ -617,6 +629,9 @@ class Element():
self.metadata = metadata # type: Any self.metadata = metadata # type: Any
self.user_bind_dict = {} # Used when user defines a tkinter binding using bind method - convert bind string to key modifier self.user_bind_dict = {} # Used when user defines a tkinter binding using bind method - convert bind string to key modifier
self.user_bind_event = None # Used when user defines a tkinter binding using bind method - event data from tkinter self.user_bind_event = None # Used when user defines a tkinter binding using bind method - event data from tkinter
self.pad_used = (0,0) # the amount of pad used when was inserted into the layout
def _RightClickMenuCallback(self, event): def _RightClickMenuCallback(self, event):
""" """
@ -632,7 +647,8 @@ class Element():
""" """
Callback function called when user chooses a menu item from menubar, Button Menu or right click menu Callback function called when user chooses a menu item from menubar, Button Menu or right click menu
:param item_chosen: (str) String holding the value chosen. :param item_chosen: String holding the value chosen.
:type item_chosen: str
""" """
# print('IN MENU ITEM CALLBACK', item_chosen) # print('IN MENU ITEM CALLBACK', item_chosen)
@ -649,6 +665,7 @@ class Element():
:param form: the Window object to search :param form: the Window object to search
:return: Union[Button, None] Button Object if a button is found, else None if no button found :return: Union[Button, None] Button Object if a button is found, else None if no button found
:rtype: Button Object if a button is found, else None if no button found
""" """
for row in form.Rows: for row in form.Rows:
for element in row: for element in row:
@ -862,7 +879,8 @@ class Element():
""" """
Called by application to change the tooltip text for an Element. Normally invoked using the Element Object such as: window.Element('key').SetToolTip('New tip'). Called by application to change the tooltip text for an Element. Normally invoked using the Element Object such as: window.Element('key').SetToolTip('New tip').
:param tooltip_text: (str) the text to show in tooltip. :param tooltip_text: the text to show in tooltip.
:type tooltip_text: str
""" """
self.TooltipObject = ToolTip(self.Widget, text=tooltip_text, timeout=DEFAULT_TOOLTIP_TIME) self.TooltipObject = ToolTip(self.Widget, text=tooltip_text, timeout=DEFAULT_TOOLTIP_TIME)
@ -870,7 +888,8 @@ class Element():
""" """
Sets the current focus to be on this element Sets the current focus to be on this element
:param force: (bool) if True will call focus_force otherwise calls focus_set :param force: if True will call focus_force otherwise calls focus_set
:type force: bool
""" """
try: try:
@ -886,7 +905,8 @@ class Element():
Changes the size of an element to a specific size. Changes the size of an element to a specific size.
It's possible to specify None for one of sizes so that only 1 of the element's dimensions are changed. It's possible to specify None for one of sizes so that only 1 of the element's dimensions are changed.
:param size: Tuple[int, int] The size in characters, rows typically. In some cases they are pixels :param size: The size in characters, rows typically. In some cases they are pixels
:type size: Tuple[int, int]
""" """
try: try:
if size[0] != None: if size[0] != None:
@ -905,7 +925,8 @@ class Element():
def get_size(self): def get_size(self):
""" """
Return the size of an element in Pixels. Care must be taken as some elements use characters to specify their size but will return pixels when calling this get_size method. Return the size of an element in Pixels. Care must be taken as some elements use characters to specify their size but will return pixels when calling this get_size method.
:return: Tuple[int, int] - Width, Height of the element :return: width and height of the element
:rtype: Tuple[int, int]
""" """
try: try:
w = self.Widget.winfo_width() w = self.Widget.winfo_width()
@ -1002,26 +1023,44 @@ class InputText(Element):
change_submits=False, enable_events=False, do_not_clear=True, key=None, focus=False, pad=None, change_submits=False, enable_events=False, do_not_clear=True, key=None, focus=False, pad=None,
use_readonly_for_disable=True, right_click_menu=None, visible=True, metadata=None): use_readonly_for_disable=True, right_click_menu=None, visible=True, metadata=None):
""" """
:param default_text: Text initially shown in the input box as a default value(Default value = '')
:param default_text: (str) Text initially shown in the input box as a default value(Default value = '') :type default_text: (str)
:param size: Tuple[int, int] (width, height) w=characters-wide, h=rows-high :param size: w=characters-wide, h=rows-high
:param disabled: (bool) set disable state for element (Default = False) :type size: Tuple[int, int] (width, height)
:param password_char: (char) Password character if this is a password field (Default value = '') :param disabled: set disable state for element (Default = False)
:param justification: (str) justification for data display. Valid choices - left, right, center :type disabled: (bool)
:param background_color: (str) color of background in one of the color formats :param password_char: Password character if this is a password field (Default value = '')
:param text_color: (str) color of the text :type password_char: (char)
:param font: Union[str, Tuple[str, int]] specifies the font family, size, etc :param justification: justification for data display. Valid choices - left, right, center
:param tooltip: (str) text, that will appear when mouse hovers over the element :type justification: (str)
:param change_submits: (bool) * DEPRICATED DO NOT USE! Same as enable_events :param background_color: color of background in one of the color formats
:param enable_events: (bool) If True then changes to this element are immediately reported as an event. Use this instead of change_submits (Default = False) :type background_color: (str)
:param do_not_clear: (bool) If False then the field will be set to blank after ANY event (button, any event) (Default = True) :param text_color: color of the text
:param key: (any) Value that uniquely identifies this element from all other elements. Used when Finding an element or in return values. Must be unique to the window :type text_color: (str)
:param focus: (bool) Determines if initial focus should go to this element. :param font: specifies the font family, size, etc
:param pad: (int, int) or ((int, int), (int, int)) Tuple(s). Amount of padding to put around element. Normally (horizontal pixels, vertical pixels) but can be split apart further into ((horizontal left, horizontal right), (vertical above, vertical below)) :type font: Union[str, Tuple[str, int]]
:param use_readonly_for_disable: (bool) If True (the default) tkinter state set to 'readonly'. Otherwise state set to 'disabled' :param tooltip: text, that will appear when mouse hovers over the element
:param right_click_menu: List[List[Union[List[str],str]]] A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. :type tooltip: (str)
:param visible: (bool) set visibility state of the element (Default = True) :param change_submits: * DEPRICATED DO NOT USE! Same as enable_events
:param metadata: (Any) User metadata that can be set to ANYTHING :type change_submits: (bool)
:param enable_events: If True then changes to this element are immediately reported as an event. Use this instead of change_submits (Default = False)
:type enable_events: (bool)
:param do_not_clear: If False then the field will be set to blank after ANY event (button, any event) (Default = True)
:type do_not_clear: (bool)
:param key: Value that uniquely identifies this element from all other elements. Used when Finding an element or in return values. Must be unique to the window
:type key: (any)
:param focus: Determines if initial focus should go to this element.
:type focus: (bool)
:param pad: . Amount of padding to put around element. Normally (horizontal pixels, vertical pixels) but can be split apart further into ((horizontal left, horizontal right), (vertical above, vertical below))
:type pad: (int, int) or ((int, int), (int, int)) Tuple(s)
:param use_readonly_for_disable: If True (the default) tkinter state set to 'readonly'. Otherwise state set to 'disabled'
:type use_readonly_for_disable: (bool)
: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.
:type right_click_menu: List[List[Union[List[str],str]]]
:param visible: set visibility state of the element (Default = True)
:type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
:type metadata: Any
""" """
self.DefaultText = default_text self.DefaultText = default_text
self.PasswordCharacter = password_char self.PasswordCharacter = password_char
@ -1042,13 +1081,20 @@ class InputText(Element):
""" """
Changes some of the settings for the Input Element. Must call `Window.Read` or `Window.Finalize` prior Changes some of the settings for the Input Element. Must call `Window.Read` or `Window.Finalize` prior
:param value: (str) new text to display as default text in Input field :param value: new text to display as default text in Input field
:param disabled: (bool) disable or enable state of the element (sets Entry Widget to readonly or normal) :type value: (str)
:param select: (bool) if True, then the text will be selected :param disabled: disable or enable state of the element (sets Entry Widget to readonly or normal)
:param visible: (bool) change visibility of element :type disabled: (bool)
:param text_color: (str) change color of text being typed :param select: if True, then the text will be selected
:param background_color: (str) change color of the background :type select: (bool)
:param move_cursor_to: Union[int, str] Moves the cursor to a particular offset. Defaults to 'end' :param visible: change visibility of element
:type visible: (bool)
:param text_color: change color of text being typed
:type text_color: (str)
:param background_color: change color of the background
:type background_color: (str)
:param move_cursor_to: Moves the cursor to a particular offset. Defaults to 'end'
:type move_cursor_to: Union[int, str]
""" """
if self.Widget is None: if self.Widget is None:
warnings.warn('You cannot Update element with key = {} until the window has been Read or Finalized'.format(self.Key), UserWarning) warnings.warn('You cannot Update element with key = {} until the window has been Read or Finalized'.format(self.Key), UserWarning)
@ -1076,13 +1122,14 @@ class InputText(Element):
if visible is False: if visible is False:
self.TKEntry.pack_forget() self.TKEntry.pack_forget()
elif visible is True: elif visible is True:
self.TKEntry.pack() self.TKEntry.pack(padx=self.pad_used[0], pady=self.pad_used[1])
def Get(self): def Get(self):
""" """
Read and return the current value of the input element. Must call `Window.Read` or `Window.Finalize` prior Read and return the current value of the input element. Must call `Window.Read` or `Window.Finalize` prior
:return: (str) current value of Input field or '' if error encountered :return: current value of Input field or '' if error encountered
:rtype: (str)
""" """
try: try:
text = self.TKStringVar.get() text = self.TKStringVar.get()
@ -1114,22 +1161,38 @@ class Combo(Element):
text_color=None, change_submits=False, enable_events=False, disabled=False, key=None, pad=None, text_color=None, change_submits=False, enable_events=False, disabled=False, key=None, pad=None,
tooltip=None, readonly=False, font=None, visible=True, metadata=None): tooltip=None, readonly=False, font=None, visible=True, metadata=None):
""" """
:param values: List[Any] values to choose. While displayed as text, the items returned are what the caller supplied, not text :param values: values to choose. While displayed as text, the items returned are what the caller supplied, not text
:param default_value: (Any) Choice to be displayed as initial value. Must match one of values variable contents :type values: List[Any]
:param size: Tuple[int, int] (width, height) width = characters-wide, height = rows-high :param default_value: Choice to be displayed as initial value. Must match one of values variable contents
:param auto_size_text: (bool) True if element should be the same size as the contents :type default_value: (Any)
:param background_color: (str) color of background :param size: width = characters-wide, height = rows-high
:param text_color: (str) color of the text :type size: Tuple[int, int] (width, height)
:param change_submits: (bool) DEPRICATED DO NOT USE. Use `enable_events` instead :param auto_size_text: True if element should be the same size as the contents
:param enable_events: (bool) Turns on the element specific events. Combo event is when a choice is made :type auto_size_text: (bool)
:param disabled: (bool) set disable state for element :param background_color: color of background
:param key: (Any) Used with window.FindElement and with return values to uniquely identify this element :type background_color: (str)
:param pad: (int, int) or ((int, int),(int,int)) Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom)) :param text_color: color of the text
:param tooltip: (str) text that will appear when mouse hovers over this element :type text_color: (str)
:param readonly: (bool) make element readonly (user can't change). True means user cannot change :param change_submits: DEPRICATED DO NOT USE. Use `enable_events` instead
:param font: Union[str, Tuple[str, int]] specifies the font family, size, etc :type change_submits: (bool)
:param visible: (bool) set visibility state of the element :param enable_events: Turns on the element specific events. Combo event is when a choice is made
:param metadata: (Any) User metadata that can be set to ANYTHING :type enable_events: (bool)
:param disabled: set disable state for element
:type disabled: (bool)
:para key: Used with window.FindElement and with return values to uniquely identify this element
:type key: (Any)
:param: Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom))
:type pad: (int, int) or ((int, int),(int,int))
:para tooltip: text that will appear when mouse hovers over this element
:type tooltip: (str)
:par readonly: make element readonly (user can't change). True means user cannot change
:type readonly: (bool)
:param font: specifies the font family, size, etc
:type font: Union[str, Tuple[str, int]]
:param visible: set visibility state of the element
:type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
:type metadata: Any
""" """
self.Values = values self.Values = values
self.DefaultValue = default_value self.DefaultValue = default_value
@ -1146,14 +1209,20 @@ class Combo(Element):
def Update(self, value=None, values=None, set_to_index=None, disabled=None, readonly=None, font=None, visible=None): def Update(self, value=None, values=None, set_to_index=None, disabled=None, readonly=None, font=None, visible=None):
""" """
Changes some of the settings for the Combo Element. Must call `Window.Read` or `Window.Finalize` prior Changes some of the settings for the Combo Element. Must call `Window.Read` or `Window.Finalize` prior
:param value: change which value is current selected hased on new list of previous list of choices
:param value: (Any) change which value is current selected hased on new list of previous list of choices :type value: (Any)
:param values: List[Any] change list of choices :param values: change list of choices
:param set_to_index: (int) change selection to a particular choice starting with index = 0 :type values: List[Any]
:param disabled: (bool) disable or enable state of the element :param set_to_index: change selection to a particular choice starting with index = 0
:param readonly: (bool) if True make element readonly (user cannot change any choices) :type set_to_index: (int)
:param font: Union[str, Tuple[str, int]] specifies the font family, size, etc :param disabled: disable or enable state of the element
:param visible: (bool) control visibility of element :type disabled: (bool)
:param readonly: if True make element readonly (user cannot change any choices)
:type readonly: (bool)
:param font: specifies the font family, size, etc
:type font: Union[str, Tuple[str, int]]
:param visible: control visibility of element
:type visible: (bool)
""" """
if self.Widget is None: if self.Widget is None:
@ -1199,7 +1268,7 @@ class Combo(Element):
if visible is False: if visible is False:
self.TKCombo.pack_forget() self.TKCombo.pack_forget()
elif visible is True: elif visible is True:
self.TKCombo.pack() self.TKCombo.pack(padx=self.pad_used[0], pady=self.pad_used[1])
def Get(self): def Get(self):
""" """
@ -1244,18 +1313,29 @@ class OptionMenu(Element):
def __init__(self, values, default_value=None, size=(None, None), disabled=False, auto_size_text=None, def __init__(self, values, default_value=None, size=(None, None), disabled=False, auto_size_text=None,
background_color=None, text_color=None, key=None, pad=None, tooltip=None, visible=True, metadata=None): background_color=None, text_color=None, key=None, pad=None, tooltip=None, visible=True, metadata=None):
""" """
:param values: List[Any] Values to be displayed :param values: Values to be displayed
:param default_value: (Any) the value to choose by default :type values: List[Any]
:param size: Tuple[int, int] (width, height) size in characters (wide) and rows (high) :param default_value: the value to choose by default
:param disabled: (bool) control enabled / disabled :type default_value: (Any)
:param auto_size_text: (bool) True if size of Element should match the contents of the items :param size: size in characters (wide) and rows (high)
:param background_color: (str) color of background :type size: Tuple[int, int] (width, height)
:param text_color: (str) color of the text :param disabled: control enabled / disabled
:param key: (Any) Used with window.FindElement and with return values to uniquely identify this element :type disabled: (bool)
:param pad: (int, int) or ((int, int),(int,int)) Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom)) :param auto_size_text: True if size of Element should match the contents of the items
:type auto_size_text: (bool)
:param background_color: color of background
:type background_color: (str)
:param text_color: color of the text
:type text_color: (str)
:param key: Used with window.FindElement and with return values to uniquely identify this element
:type key: (Any)
:param pad: Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom))
:type pad: (int, int) or ((int, int),(int,int))
:param tooltip: (str) text that will appear when mouse hovers over this element :param tooltip: (str) text that will appear when mouse hovers over this element
:type tooltip: (str)
:param visible: (bool) set visibility state of the element :param visible: (bool) set visibility state of the element
:param metadata: (Any) User metadata that can be set to ANYTHING :type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
""" """
self.Values = values self.Values = values
self.DefaultValue = default_value self.DefaultValue = default_value
@ -1270,11 +1350,14 @@ class OptionMenu(Element):
def Update(self, value=None, values=None, disabled=None, visible=None): def Update(self, value=None, values=None, disabled=None, visible=None):
""" """
Changes some of the settings for the OptionMenu Element. Must call `Window.Read` or `Window.Finalize` prior Changes some of the settings for the OptionMenu Element. Must call `Window.Read` or `Window.Finalize` prior
:param value: the value to choose by default
:param value: (Any) the value to choose by default :type value: (Any)
:param values: List[Any] Values to be displayed :param values: Values to be displayed
:param disabled: (bool) disable or enable state of the element :type values: List[Any]
:param visible: (bool) control visibility of element :param disabled: disable or enable state of the element
:type disabled: (bool)
:param visible: control visibility of element
:type visible: (bool)
""" """
if self.Widget is None: if self.Widget is None:
@ -1305,7 +1388,7 @@ class OptionMenu(Element):
if visible is False: if visible is False:
self.TKOptionMenu.pack_forget() self.TKOptionMenu.pack_forget()
elif visible is True: elif visible is True:
self.TKOptionMenu.pack() self.TKOptionMenu.pack(padx=self.pad_used[0], pady=self.pad_used[1])
set_focus = Element.SetFocus set_focus = Element.SetFocus
set_tooltip = Element.SetTooltip set_tooltip = Element.SetTooltip
@ -1330,28 +1413,42 @@ class Listbox(Element):
background_color=None, text_color=None, key=None, pad=None, tooltip=None, right_click_menu=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None, right_click_menu=None,
visible=True, metadata=None): visible=True, metadata=None):
""" """
:param values: List[Any] list of values to display. Can be any type including mixed types as long as they have __str__ method :param values: list of values to display. Can be any type including mixed types as long as they have __str__ method
:param default_values: List[Any] which values should be initially selected :type values: List[Any]
:param select_mode: [enum] Select modes are used to determine if only 1 item can be selected or multiple and how they can be selected. Valid choices begin with "LISTBOX_SELECT_MODE_" and include: :param default_values: which values should be initially selected
LISTBOX_SELECT_MODE_SINGLE :type default_values: List[Any]
LISTBOX_SELECT_MODE_MULTIPLE :param select_mode: Select modes are used to determine if only 1 item can be selected or multiple and how they can be selected. Valid choices begin with "LISTBOX_SELECT_MODE_" and include: LISTBOX_SELECT_MODE_SINGLE LISTBOX_SELECT_MODE_MULTIPLE LISTBOX_SELECT_MODE_BROWSE LISTBOX_SELECT_MODE_EXTENDED
LISTBOX_SELECT_MODE_BROWSE :type select_mode: [enum]
LISTBOX_SELECT_MODE_EXTENDED :param change_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
:param change_submits: (bool) DO NOT USE. Only listed for backwards compat - Use enable_events instead :type change_submits: (bool)
:param enable_events: (bool) Turns on the element specific events. Listbox generates events when an item is clicked :param enable_events: Turns on the element specific events. Listbox generates events when an item is clicked
:param bind_return_key: (bool) If True, then the return key will cause a the Listbox to generate an event :type enable_events: (bool)
:param size: Tuple(int, int) (width, height) width = characters-wide, height = rows-high :param bind_return_key: If True, then the return key will cause a the Listbox to generate an event
:param disabled: (bool) set disable state for element :type bind_return_key: (bool)
:param auto_size_text: (bool) True if element should be the same size as the contents :param size: width = characters-wide, height = rows-high
:param font: Union[str, Tuple[str, int]] specifies the font family, size, etc :type size: Tuple(int, int) (width, height)
:param background_color: (str) color of background :param disabled: set disable state for element
:param text_color: (str) color of the text :type disabled: (bool)
:param key: (Any) Used with window.FindElement and with return values to uniquely identify this element :param auto_size_text: True if element should be the same size as the contents
:param pad: (int, int) or ((int, int),(int,int)) Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom)) :type auto_size_text: (bool)
:param tooltip: (str) text, that will appear when mouse hovers over the element :param font: specifies the font family, size, etc
:param right_click_menu: List[List[Union[List[str],str]]] A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. :type font: Union[str, Tuple[str, int]]
:param visible: (bool) set visibility state of the element :param background_color: color of background
:param metadata: (Any) User metadata that can be set to ANYTHING :type background_color: (str)
:param text_color: color of the text
:type text_color: (str)
:param key: Used with window.FindElement and with return values to uniquely identify this element
:type key: (Any)
:param pad: Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom))
:type pad: (int, int) or ((int, int),(int,int))
:param tooltip: text, that will appear when mouse hovers over the element
:type tooltip: (str)
: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.
:type right_click_menu: List[List[Union[List[str],str]]]
:param visible: set visibility state of the element
:type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
:type metadata: Any
""" """
self.Values = values self.Values = values
self.DefaultValues = default_values self.DefaultValues = default_values
@ -1381,13 +1478,18 @@ class Listbox(Element):
def Update(self, values=None, disabled=None, set_to_index=None, scroll_to_index=None, select_mode=None, visible=None): def Update(self, values=None, disabled=None, set_to_index=None, scroll_to_index=None, select_mode=None, visible=None):
""" """
Changes some of the settings for the Listbox Element. Must call `Window.Read` or `Window.Finalize` prior Changes some of the settings for the Listbox Element. Must call `Window.Read` or `Window.Finalize` prior
:param values: new list of choices to be shown to user
:param values: List[Any] new list of choices to be shown to user :type values: List[Any]
:param disabled: (bool) disable or enable state of the element :param disabled: disable or enable state of the element
:param set_to_index: Union[int, list, tuple] highlights the item(s) indicated. If parm is an int one entry will be set. If is a list, then each entry in list is highlighted :type disabled: (bool)
:param scroll_to_index: (int) scroll the listbox so that this index is the first shown :param set_to_index: highlights the item(s) indicated. If parm is an int one entry will be set. If is a list, then each entry in list is highlighted
:param mode: (str) changes the select mode according to tkinter's listbox widget :type set_to_index: Union[int, list, tuple]
:param visible: (bool) control visibility of element :param scroll_to_index: scroll the listbox so that this index is the first shown
:type scroll_to_index: (int)
:param mode: changes the select mode according to tkinter's listbox widget
:type mode: (str)
:param visible: control visibility of element
:type visible: (bool)
""" """
if self.Widget is None: if self.Widget is None:
@ -1421,7 +1523,7 @@ class Listbox(Element):
if not self.NoScrollbar: if not self.NoScrollbar:
self.vsb.pack_forget() self.vsb.pack_forget()
elif visible is True: elif visible is True:
self.TKListbox.pack() self.TKListbox.pack(padx=self.pad_used[0], pady=self.pad_used[1])
if not self.NoScrollbar: if not self.NoScrollbar:
self.vsb.pack() self.vsb.pack()
if scroll_to_index is not None and len(self.Values): if scroll_to_index is not None and len(self.Values):
@ -1436,7 +1538,8 @@ class Listbox(Element):
""" """
Set listbox highlighted choices Set listbox highlighted choices
:param values: List[Any] new values to choose based on previously set values :param values: new values to choose based on previously set values
:type values: List[Any]
""" """
for index, item in enumerate(self.Values): for index, item in enumerate(self.Values):
@ -1454,7 +1557,8 @@ class Listbox(Element):
""" """
Returns list of Values provided by the user in the user's format Returns list of Values provided by the user in the user's format
:return: List[Any]. List of values. Can be any / mixed types -> [] :return: List of values. Can be any / mixed types -> []
:rtype: List[Any]
""" """
return self.Values return self.Values
@ -1462,7 +1566,8 @@ class Listbox(Element):
""" """
Returns the items currently selected as a list of indexes Returns the items currently selected as a list of indexes
:return: List[int] A list of offsets into values that is currently selected :return: A list of offsets into values that is currently selected
:rtype: List[int]
""" """
return self.TKListbox.curselection() return self.TKListbox.curselection()
@ -1472,7 +1577,8 @@ class Listbox(Element):
Returns the list of items currently selected in this listbox. It should be identical Returns the list of items currently selected in this listbox. It should be identical
to the value you would receive when performing a window.read() call. to the value you would receive when performing a window.read() call.
:return: List[Any] The list of currently selected items. The actual items are returned, not the indexes :return: The list of currently selected items. The actual items are returned, not the indexes
:rtype: List[Any]
""" """
try: try:
items = self.TKListbox.curselection() items = self.TKListbox.curselection()
@ -1508,23 +1614,38 @@ class Radio(Element):
background_color=None, text_color=None, font=None, key=None, pad=None, tooltip=None, background_color=None, text_color=None, font=None, key=None, pad=None, tooltip=None,
change_submits=False, enable_events=False, visible=True, metadata=None): change_submits=False, enable_events=False, visible=True, metadata=None):
""" """
:param text: Text to display next to button
:param text: (str) Text to display next to button :type text: (str)
:param group_id: (Any) Groups together multiple Radio Buttons. Any type works :param group_id: Groups together multiple Radio Buttons. Any type works
:param default: (bool). Set to True for the one element of the group you want initially selected :type group_id: (Any)
:param disabled: (bool) set disable state :param default: Set to True for the one element of the group you want initially selected
:param size: Tuple[int, int] (width, height) width = characters-wide, height = rows-high :type default: (bool)
:param auto_size_text: (bool) if True will size the element to match the length of the text :param disabled: set disable state
:param background_color: (str) color of background :type disabled: (bool)
:param text_color: (str) color of the text :param size: int] (width, height) width = characters-wide, height = rows-high
:param font: Union[str, Tuple[str, int]] specifies the font family, size, etc :type size: Tuple[int,
:param key: (Any) Used with window.FindElement and with return values to uniquely identify this element :param auto_size_text: if True will size the element to match the length of the text
:param pad: (int, int) or ((int, int),(int,int)) Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom)) :type auto_size_text: (bool)
:param tooltip: (str) text, that will appear when mouse hovers over the element :param background_color: color of background
:param change_submits: (bool) DO NOT USE. Only listed for backwards compat - Use enable_events instead :type background_color: (str)
:param enable_events: (bool) Turns on the element specific events. Radio Button events happen when an item is selected :param text_color: color of the text
:param visible: (bool) set visibility state of the element :type text_color: (str)
:param metadata: (Any) User metadata that can be set to ANYTHING :param font: specifies the font family, size, etc
:type font: Union[str, Tuple[str, int]]
:param key: Used with window.FindElement and with return values to uniquely identify this element
:type key: (Any)
:param pad: Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom))
:type pad: (int, int) or ((int, int),(int,int))
:param tooltip: text, that will appear when mouse hovers over the element
:type tooltip: (str)
:param change_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
:type change_submits: (bool)
:param enable_events: Turns on the element specific events. Radio Button events happen when an item is selected
:type enable_events: (bool)
:param visible: set visibility state of the element
:type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
:type metadata: Any
""" """
self.InitialState = default self.InitialState = default
@ -1555,10 +1676,12 @@ class Radio(Element):
def Update(self, value=None, disabled=None, visible=None): def Update(self, value=None, disabled=None, visible=None):
""" """
Changes some of the settings for the Radio Button Element. Must call `Window.Read` or `Window.Finalize` prior Changes some of the settings for the Radio Button Element. Must call `Window.Read` or `Window.Finalize` prior
:param value: if True change to selected and set others in group to unselected
:param value: (bool) if True change to selected and set others in group to unselected :type value: (bool)
:param disabled: (bool) disable or enable state of the element :param disabled: disable or enable state of the element
:param visible: (bool) control visibility of element :type disabled: (bool)
:param visible: control visibility of element
:type visible: (bool)
""" """
if self.Widget is None: if self.Widget is None:
@ -1578,7 +1701,7 @@ class Radio(Element):
if visible is False: if visible is False:
self.TKRadio.pack_forget() self.TKRadio.pack_forget()
elif visible is True: elif visible is True:
self.TKRadio.pack() self.TKRadio.pack(padx=self.pad_used[0], pady=self.pad_used[1])
def ResetGroup(self): def ResetGroup(self):
""" """
@ -1591,7 +1714,8 @@ class Radio(Element):
""" """
A snapshot of the value of Radio Button -> (bool) A snapshot of the value of Radio Button -> (bool)
:return: (bool) True if this radio button is selected :return: True if this radio button is selected
:rtype: (bool)
""" """
return self.TKIntVar.get() == self.EncodedRadioValue return self.TKIntVar.get() == self.EncodedRadioValue
@ -1618,21 +1742,36 @@ class Checkbox(Element):
text_color=None, change_submits=False, enable_events=False, disabled=False, key=None, pad=None, text_color=None, change_submits=False, enable_events=False, disabled=False, key=None, pad=None,
tooltip=None, visible=True, metadata=None): tooltip=None, visible=True, metadata=None):
""" """
:param text: (str) Text to display next to checkbox :param text: Text to display next to checkbox
:param default: (bool). Set to True if you want this checkbox initially checked :type text: (str)
:param size: Tuple[int, int] (width, height) width = characters-wide, height = rows-high :param default: Set to True if you want this checkbox initially checked
:param auto_size_text: (bool) if True will size the element to match the length of the text :type default: (bool)
:param font: Union[str, Tuple[str, int]] specifies the font family, size, etc :param size: (width, height) width = characters-wide, height = rows-high
:param background_color: (str) color of background :type size: Tuple[int, int]
:param text_color: (str) color of the text :param auto_size_text: if True will size the element to match the length of the text
:param change_submits: (bool) DO NOT USE. Only listed for backwards compat - Use enable_events instead :type auto_size_text: (bool)
:param enable_events: (bool) Turns on the element specific events. Checkbox events happen when an item changes :param font: specifies the font family, size, etc
:param disabled: (bool) set disable state :type font: Union[str, Tuple[str, int]]
:param key: (Any) Used with window.FindElement and with return values to uniquely identify this element :param background_color: color of background
:param pad: (int, int) or ((int, int),(int,int)) Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom)) :type background_color: (str)
:param tooltip: (str) text, that will appear when mouse hovers over the element :param text_color: color of the text
:param visible: (bool) set visibility state of the element :type text_color: (str)
:param metadata: (Any) User metadata that can be set to ANYTHING :param change_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
:type change_submits: (bool)
:param enable_events: Turns on the element specific events. Checkbox events happen when an item changes
:type enable_events: (bool)
:param disabled: set disable state
:type disabled: (bool)
:param key: Used with window.FindElement and with return values to uniquely identify this element
:type key: (Any)
:param pad: Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom))
:type pad: (int, int) or ((int, int),(int,int))
:param tooltip: text, that will appear when mouse hovers over the element
:type tooltip: (str)
:param visible: set visibility state of the element
:type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
:type metadata: Any
""" """
self.Text = text self.Text = text
@ -1666,7 +1805,8 @@ class Checkbox(Element):
""" """
Return the current state of this checkbox Return the current state of this checkbox
:return: (bool) Current state of checkbox :return: Current state of checkbox
:rtype: (bool)
""" """
return self.TKIntVar.get() return self.TKIntVar.get()
@ -1674,12 +1814,16 @@ class Checkbox(Element):
""" """
Changes some of the settings for the Checkbox Element. Must call `Window.Read` or `Window.Finalize` prior. Changes some of the settings for the Checkbox Element. Must call `Window.Read` or `Window.Finalize` prior.
Note that changing visibility may cause element to change locations when made visible after invisible Note that changing visibility may cause element to change locations when made visible after invisible
:param value: if True checks the checkbox, False clears it
:param value: (bool) if True checks the checkbox, False clears it :type value: (bool)
:param background_color: (str) color of background :param background_color: color of background
:param text_color: (str) color of the text. Note this also changes the color of the checkmark :type background_color: (str)
:param disabled: (bool) disable or enable element :param text_color: color of the text. Note this also changes the color of the checkmark
:param visible: (bool) control visibility of element :type text_color: (str)
:param disabled: disable or enable element
:type disabled: (bool)
:param visible: control visibility of element
:type visible: (bool)
""" """
if self.Widget is None: if self.Widget is None:
@ -1722,7 +1866,7 @@ class Checkbox(Element):
if visible is False: if visible is False:
self.TKCheckbutton.pack_forget() self.TKCheckbutton.pack_forget()
elif visible is True: elif visible is True:
self.TKCheckbutton.pack() self.TKCheckbutton.pack(padx=self.pad_used[0], pady=self.pad_used[1])
get = Get get = Get
set_focus = Element.SetFocus set_focus = Element.SetFocus
@ -1749,22 +1893,36 @@ class Spin(Element):
size=(None, None), auto_size_text=None, font=None, background_color=None, text_color=None, key=None, 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): pad=None, tooltip=None, visible=True, metadata=None):
""" """
:param values: List of valid values
:param values: List[Any] List of valid values :type values: List[Any]
:param initial_value: (Any) Initial item to show in window. Choose from list of values supplied :param initial_value: Initial item to show in window. Choose from list of values supplied
:param disabled: (bool) set disable state :type initial_value: (Any)
:param change_submits: (bool) DO NOT USE. Only listed for backwards compat - Use enable_events instead :param disabled: set disable state
:param enable_events: (bool) Turns on the element specific events. Spin events happen when an item changes :type disabled: (bool)
:param size: Tuple[int, int] (width, height) width = characters-wide, height = rows-high :param change_submits: DO NOT USE. Only listed for backwards compat - Use enable_events instead
:param auto_size_text: (bool) if True will size the element to match the length of the text :type change_submits: (bool)
:param font: Union[str, Tuple[str, int]] specifies the font family, size, etc :param enable_events: Turns on the element specific events. Spin events happen when an item changes
:param background_color: (str) color of background :type enable_events: (bool)
:param text_color: (str) color of the text :param size: (width, height) width = characters-wide, height = rows-high
:param key: (Any) Used with window.FindElement and with return values to uniquely identify this element :type size: Tuple[int, int]
:param pad: (int, int) or ((int, int),(int,int)) Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom)) :param auto_size_text: if True will size the element to match the length of the text
:param tooltip: (str) text, that will appear when mouse hovers over the element :type auto_size_text: (bool)
:param visible: (bool) set visibility state of the element :param font: specifies the font family, size, etc
:param metadata: (Any) User metadata that can be set to ANYTHING :type font: Union[str, Tuple[str, int]]
:param background_color: color of background
:type background_color: (str)
:param text_color: color of the text
:type text_color: (str)
:param key: Used with window.FindElement and with return values to uniquely identify this element
:type key: (Any)
:param pad: Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom))
:type pad: (int, int) or ((int, int),(int,int))
:param tooltip: text, that will appear when mouse hovers over the element
:type tooltip: (str)
:param visible: set visibility state of the element
:type visible: (bool)
:param metadata: User metadata that can be set to ANYTHING
:type metadata: Any
""" """
self.Values = values self.Values = values
@ -1782,11 +1940,14 @@ class Spin(Element):
def Update(self, value=None, values=None, disabled=None, visible=None): def Update(self, value=None, values=None, disabled=None, visible=None):
""" """
Changes some of the settings for the Spin Element. Must call `Window.Read` or `Window.Finalize` prior Changes some of the settings for the Spin Element. Must call `Window.Read` or `Window.Finalize` prior
:param value: set the current value from list of choices
:param value: (Any) set the current value from list of choices :type value: (Any)
:param values: List[Any] set available choices :param values: set available choices
:param disabled: (bool) disable or enable state of the element :type values: List[Any]
:param visible: (bool) control visibility of element :param disabled: disable or enable state of the element
:type disabled: (bool)
:param visible: control visibility of element
:type visible: (bool)
""" """
if self.Widget is None: if self.Widget is None:
@ -1812,7 +1973,7 @@ class Spin(Element):
if visible is False: if visible is False:
self.TKSpinBox.pack_forget() self.TKSpinBox.pack_forget()
elif visible is True: elif visible is True:
self.TKSpinBox.pack() self.TKSpinBox.pack(padx=self.pad_used[0], pady=self.pad_used[1])
def _SpinChangedHandler(self, event): def _SpinChangedHandler(self, event):
""" """
@ -1943,9 +2104,9 @@ class Multiline(Element):
self.DefaultText = value self.DefaultText = value
if self.Autoscroll: if self.Autoscroll:
self.TKText.see(tk.END) self.TKText.see(tk.END)
if disabled == True: if disabled is True:
self.TKText.configure(state='disabled') self.TKText.configure(state='disabled')
elif disabled == False: elif disabled is False:
self.TKText.configure(state='normal') self.TKText.configure(state='normal')
if background_color is not None: if background_color is not None:
self.TKText.configure(background=background_color) self.TKText.configure(background=background_color)
@ -1956,7 +2117,7 @@ class Multiline(Element):
if visible is False: if visible is False:
self.TKText.pack_forget() self.TKText.pack_forget()
elif visible is True: elif visible is True:
self.TKText.pack() self.TKText.pack(padx=self.pad_used[0], pady=self.pad_used[1])
self.TagCounter += 1 # doesn't matter if the counter is bumped every call self.TagCounter += 1 # doesn't matter if the counter is bumped every call
def Get(self): def Get(self):
@ -1980,7 +2141,7 @@ class Multiline(Element):
:param text_color: The color of the text :param text_color: The color of the text
:param background_color: The background color of the line :param background_color: The background color of the line
""" """
print_to_element(self, *args, end=end, sep=sep, text_color=text_color, background_color=background_color) _print_to_element(self, *args, end=end, sep=sep, text_color=text_color, background_color=background_color)
@ -2067,7 +2228,7 @@ class Text(Element):
if visible is False: if visible is False:
self.TKText.pack_forget() self.TKText.pack_forget()
elif visible is True: elif visible is True:
self.TKText.pack() self.TKText.pack(padx=self.pad_used[0], pady=self.pad_used[1])
set_focus = Element.SetFocus set_focus = Element.SetFocus
set_tooltip = Element.SetTooltip set_tooltip = Element.SetTooltip
@ -2151,7 +2312,7 @@ class StatusBar(Element):
if visible is False: if visible is False:
self.TKText.pack_forget() self.TKText.pack_forget()
elif visible is True: elif visible is True:
self.TKText.pack() self.TKText.pack(padx=self.pad_used[0], pady=self.pad_used[1])
set_focus = Element.SetFocus set_focus = Element.SetFocus
set_tooltip = Element.SetTooltip set_tooltip = Element.SetTooltip
@ -2371,7 +2532,7 @@ class Output(Element):
if visible is False: if visible is False:
self._TKOut.frame.pack_forget() self._TKOut.frame.pack_forget()
elif visible is True: elif visible is True:
self._TKOut.frame.pack() self._TKOut.frame.pack(padx=self.pad_used[0], pady=self.pad_used[1])
def Get(self): def Get(self):
""" """
@ -2727,7 +2888,7 @@ class Button(Element):
if visible is False: if visible is False:
self.TKButton.pack_forget() self.TKButton.pack_forget()
elif visible is True: elif visible is True:
self.TKButton.pack() self.TKButton.pack(padx=self.pad_used[0], pady=self.pad_used[1])
if disabled_button_color != (None, None): if disabled_button_color != (None, None):
if not self.UseTtkButtons: if not self.UseTtkButtons:
self.TKButton['disabledforeground'] = disabled_button_color[0] self.TKButton['disabledforeground'] = disabled_button_color[0]
@ -2857,7 +3018,7 @@ class ButtonMenu(Element):
if visible is False: if visible is False:
self.TKButtonMenu.pack_forget() self.TKButtonMenu.pack_forget()
elif visible is True: elif visible is True:
self.TKButtonMenu.pack() self.TKButtonMenu.pack(padx=self.pad_used[0], pady=self.pad_used[1])
def Click(self): def Click(self):
""" """
@ -2947,7 +3108,7 @@ class ProgressBar(Element):
if visible is False: if visible is False:
self.TKProgressBar.TKProgressBarForReal.pack_forget() self.TKProgressBar.TKProgressBarForReal.pack_forget()
elif visible is True: elif visible is True:
self.TKProgressBar.TKProgressBarForReal.pack() self.TKProgressBar.TKProgressBarForReal.pack(padx=self.pad_used[0], pady=self.pad_used[1])
set_focus = Element.SetFocus set_focus = Element.SetFocus
set_tooltip = Element.SetTooltip set_tooltip = Element.SetTooltip
@ -3036,7 +3197,7 @@ class Image(Element):
if visible is False: if visible is False:
self.tktext_label.pack_forget() self.tktext_label.pack_forget()
elif visible is True: elif visible is True:
self.tktext_label.pack() self.tktext_label.pack(padx=self.pad_used[0], pady=self.pad_used[1])
def UpdateAnimation(self, source, time_between_frames=0): def UpdateAnimation(self, source, time_between_frames=0):
""" """
@ -3573,7 +3734,7 @@ class Graph(Element):
if visible is False: if visible is False:
self._TKCanvas2.pack_forget() self._TKCanvas2.pack_forget()
elif visible is True: elif visible is True:
self._TKCanvas2.pack() self._TKCanvas2.pack(padx=self.pad_used[0], pady=self.pad_used[1])
def Move(self, x_direction, y_direction): def Move(self, x_direction, y_direction):
""" """
@ -3926,7 +4087,7 @@ class Frame(Element):
if visible is False: if visible is False:
self.TKFrame.pack_forget() self.TKFrame.pack_forget()
elif visible is True: elif visible is True:
self.TKFrame.pack() self.TKFrame.pack(padx=self.pad_used[0], pady=self.pad_used[1])
if value is not None: if value is not None:
self.TKFrame.config(text=str(value)) self.TKFrame.config(text=str(value))
@ -4411,7 +4572,7 @@ class Slider(Element):
if visible is False: if visible is False:
self.TKScale.pack_forget() self.TKScale.pack_forget()
elif visible is True: elif visible is True:
self.TKScale.pack() self.TKScale.pack(padx=self.pad_used[0], pady=self.pad_used[1])
if range != (None, None): if range != (None, None):
self.TKScale.config(from_=range[0], to_=range[1]) self.TKScale.config(from_=range[0], to_=range[1])
@ -4731,7 +4892,7 @@ class Column(Element):
self.ParentPanedWindow.remove(self.TKColFrame) self.ParentPanedWindow.remove(self.TKColFrame)
elif visible is True: elif visible is True:
if self.TKColFrame: if self.TKColFrame:
self.TKColFrame.pack() self.TKColFrame.pack(padx=self.pad_used[0], pady=self.pad_used[1])
if self.ParentPanedWindow: if self.ParentPanedWindow:
self.ParentPanedWindow.add(self.TKColFrame) self.ParentPanedWindow.add(self.TKColFrame)
@ -4810,7 +4971,7 @@ class Pane(Element):
if visible is False: if visible is False:
self.PanedWindow.pack_forget() self.PanedWindow.pack_forget()
elif visible is True: elif visible is True:
self.PanedWindow.pack() self.PanedWindow.pack(padx=self.pad_used[0], pady=self.pad_used[1])
set_focus = Element.SetFocus set_focus = Element.SetFocus
set_tooltip = Element.SetTooltip set_tooltip = Element.SetTooltip
@ -5320,7 +5481,7 @@ class Table(Element):
if visible is False: if visible is False:
self.TKTreeview.pack_forget() self.TKTreeview.pack_forget()
elif visible is True: elif visible is True:
self.TKTreeview.pack() self.TKTreeview.pack(padx=self.pad_used[0], pady=self.pad_used[1])
if num_rows is not None: if num_rows is not None:
self.TKTreeview.config(height=num_rows) self.TKTreeview.config(height=num_rows)
if select_rows is not None: if select_rows is not None:
@ -5576,7 +5737,7 @@ class Tree(Element):
if visible is False: if visible is False:
self.TKTreeview.pack_forget() self.TKTreeview.pack_forget()
elif visible is True: elif visible is True:
self.TKTreeview.pack() self.TKTreeview.pack(padx=self.pad_used[0], pady=self.pad_used[1])
return self return self
set_focus = Element.SetFocus set_focus = Element.SetFocus
@ -8651,6 +8812,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
# Set foreground color # Set foreground color
text_color = element.TextColor text_color = element.TextColor
elementpad = element.Pad if element.Pad is not None else toplevel_form.ElementPadding elementpad = element.Pad if element.Pad is not None else toplevel_form.ElementPadding
element.pad_used = elementpad # store the value used back into the element
# Determine Element size # Determine Element size
element_size = element.Size element_size = element.Size
if (element_size == (None, None) and element_type not in ( if (element_size == (None, None) and element_type not in (
@ -10606,7 +10768,7 @@ def EasyPrintClose():
# A print-like call that can be used to output to a multiline element as if it's an Output element # # A print-like call that can be used to output to a multiline element as if it's an Output element #
# ------------------------------------------------------------------------------------------------ # # ------------------------------------------------------------------------------------------------ #
def print_to_element(multiline_element, *args, end=None, sep=None, text_color=None, background_color=None): def _print_to_element(multiline_element, *args, end=None, sep=None, text_color=None, background_color=None):
""" """
Print like Python normally prints except route the output to a multline element and also add colors if desired Print like Python normally prints except route the output to a multline element and also add colors if desired