new expand_row parameter to Element.expand

This commit is contained in:
PySimpleGUI 2019-12-15 14:56:37 -05:00
parent 54f53991a0
commit 7492d3cbc7
1 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.12.0 Released 14-Dec-2019" version = __version__ = "4.12.0.1 Unreleased - Element.expand added expand_row parm"
port = 'PySimpleGUI' port = 'PySimpleGUI'
@ -865,14 +865,14 @@ class Element():
except: except:
print('Warning, error hiding element row for key =', self.Key) print('Warning, error hiding element row for key =', self.Key)
def expand(self, expand_x=False, expand_y=False): def expand(self, expand_x=False, expand_y=False, expand_row=False):
""" """
Causes the Element to expand to fill available space in the X and Y directions. Can specify which or both directions Causes the Element to expand to fill available space in the X and Y directions. Can specify which or both directions
:param expand_x: (Bool) If True Element will expand in the Horizontal directions :param expand_x: (Bool) If True Element will expand in the Horizontal directions
:param expand_y: (Bool) If True Element will expand in the Vertical directions :param expand_y: (Bool) If True Element will expand in the Vertical directions
:param expand_row: (Bool) If True the row containing the element will also expand. Without this your element is "trapped" within the row
""" """
if expand_x and expand_y: if expand_x and expand_y:
fill = tk.BOTH fill = tk.BOTH
elif expand_x: elif expand_x:
@ -883,7 +883,7 @@ class Element():
return return
self.Widget.pack(expand=True, fill=fill) self.Widget.pack(expand=True, fill=fill)
self.ParentRowFrame.pack(expand=True, fill=fill) self.ParentRowFrame.pack(expand=expand_row, fill=fill)
def __call__(self, *args, **kwargs): def __call__(self, *args, **kwargs):
""" """
@ -6192,6 +6192,14 @@ class Window:
except: except:
pass pass
self.TKrootDestroyed = True self.TKrootDestroyed = True
# for row in self.Rows:
# for elem in row:
# try:
# # elem.Widget.__del__()
# del elem.Widget
# except Exception as e:
# print(f'Exception deleting {e}')
# self.TKroot.__del__()
del self.TKroot del self.TKroot
del self.Rows del self.Rows