Fixed Text.update - crashing when making invisible

This commit is contained in:
PySimpleGUI 2022-04-02 09:31:28 -04:00
parent e575a0b8dc
commit b60de0368d
1 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.57.0.23 Unreleased" version = __version__ = "4.57.0.24 Unreleased"
_change_log = """ _change_log = """
Changelog since 4.57.0 released to PyPI on 13-Feb-2022 Changelog since 4.57.0 released to PyPI on 13-Feb-2022
@ -64,6 +64,8 @@ _change_log = """
Fix for expand and other settings being lost when element is made invisible and visible again. Fix for expand and other settings being lost when element is made invisible and visible again.
Not ALL elements have been converted over to handle correctly... checking in to get the ball rolling and will complete the others today Not ALL elements have been converted over to handle correctly... checking in to get the ball rolling and will complete the others today
So far Text, Input, Multiline, Frame, Statusbar, Combo are done So far Text, Input, Multiline, Frame, Statusbar, Combo are done
4.57.0.24
Fixed crach in the update method for Text element when making inivisible
""" """
__version__ = version.split()[0] # For PEP 396 and PEP 345 __version__ = version.split()[0] # For PEP 396 and PEP 345
@ -3044,6 +3046,7 @@ class Spin(Element):
if visible is not None: if visible is not None:
self._visible = visible self._visible = visible
def _SpinChangedHandler(self, event): def _SpinChangedHandler(self, event):
""" """
Callback function. Used internally only. Called by tkinter when Spinbox Widget changes. Results in Window.Read() call returning Callback function. Used internally only. Called by tkinter when Spinbox Widget changes. Results in Window.Read() call returning
@ -3601,7 +3604,7 @@ class Text(Element):
if font is not None: if font is not None:
self.TKText.configure(font=font) self.TKText.configure(font=font)
if visible is False: if visible is False:
element._pack_forget_save_settings() self._pack_forget_save_settings()
# self.TKText.pack_forget() # self.TKText.pack_forget()
elif visible is True: elif visible is True:
self._pack_restore_settings() self._pack_restore_settings()
@ -15239,9 +15242,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
width, height = element_size width, height = element_size
width = 0 if auto_size_text else element_size[0] width = 0 if auto_size_text else element_size[0]
element.TKStringVar = tk.StringVar() element.TKStringVar = tk.StringVar()
element.TKSpinBox = element.Widget = tk.Spinbox(tk_row_frame, values=element.Values, element.TKSpinBox = element.Widget = tk.Spinbox(tk_row_frame, values=element.Values, textvariable=element.TKStringVar, width=width, bd=border_depth)
textvariable=element.TKStringVar,
width=width, bd=border_depth)
if element.DefaultValue is not None: if element.DefaultValue is not None:
element.TKStringVar.set(element.DefaultValue) element.TKStringVar.set(element.DefaultValue)
element.TKSpinBox.configure(font=font) # set wrap to width of widget element.TKSpinBox.configure(font=font) # set wrap to width of widget
@ -15272,7 +15273,6 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
if theme_input_text_color() not in (COLOR_SYSTEM_DEFAULT, None): if theme_input_text_color() not in (COLOR_SYSTEM_DEFAULT, None):
element.Widget.config(insertbackground=theme_input_text_color()) element.Widget.config(insertbackground=theme_input_text_color())
_add_right_click_menu_and_grab(element) _add_right_click_menu_and_grab(element)
# ------------------------- OUTPUT placement element ------------------------- # # ------------------------- OUTPUT placement element ------------------------- #
elif element_type == ELEM_TYPE_OUTPUT: elif element_type == ELEM_TYPE_OUTPUT:
element = element # type: Output element = element # type: Output