Fix for Print crash. Added get_size, hide_row, unhide_row for all elements.

This commit is contained in:
PySimpleGUI 2019-09-26 17:03:18 -04:00
parent 392c5a94d3
commit f1b5aa29d3
1 changed files with 24 additions and 9 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
version = __version__ = "4.5.0.19 Unreleased Mac Buttons. Element Resizing. Screen Size"
version = __version__ = "4.5.0.20 Unreleased Mac Buttons. Element size get/set. Screen Size. hide/unhide row"
# 888888ba .d88888b oo dP .88888. dP dP dP
@ -771,6 +771,29 @@ class Element():
except:
print('Warning, error setting height on element with key=', self.Key)
def get_size(self):
try:
w = self.Widget.winfo_width()
h = self.Widget.winfo_height()
except:
print('Warning, error getting size of element', self.Key)
w = h = None
return w,h
def hide_row(self):
try:
self.ParentRowFrame.pack_forget()
except:
print('Warning, error hiding element row for key =', self.Key)
def unhide_row(self):
try:
self.ParentRowFrame.pack()
except:
print('Warning, error hiding element row for key =', self.Key)
def __call__(self, *args, **kwargs):
"""
Makes it possible to "call" an already existing element. When you do make the "call", it actually calls
@ -7930,13 +7953,6 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
unique_field = str(element.Key) + '.TCombobox.field'
# unique_field = str(time.time()).replace('.', '') + str(element.Key) + '.TCombobox.field'
# unique_field = str(time.time()).replace('.','') + '.TCombobox.field'
# unique_field = str(datetime.datetime.today().timestamp()).replace('.','') + '.TCombobox.field'
# unique_field = str(randint(1,50000000)) + '.TCombobox.field'
# print(unique_field)
# Clones over the TCombobox.field element from the "alt" theme.
# This is what will allow us to change the background color without altering the whole programs theme
@ -9307,7 +9323,6 @@ class DebugWin():
def Close(self):
""" """
self.window.Close()
self.window.__del__()
self.window = None