vtop, vcenter, vbottom - pin-like layout helper functions that will align the element to the top, center, or bottom of the row it is on

This commit is contained in:
PySimpleGUI 2020-08-17 06:48:12 -04:00
parent 413a521c89
commit 804b968b68
1 changed files with 31 additions and 1 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
version = __version__ = "4.28.0.10 Unreleased 3-Aug-2020\nAdded a referesh to visiblity_changed (an existing function but blank), added Column.contents_changed which will update the scrollbar so corrently match the contents, separators expand only in 1 direction now, added SYBOOLS for arrows circle square, dark grey 8 theme, when closing window don't delete the tkroot variable and rows but instead set to None, dark grey 9 theme, replaced check for darkwin with try/except for wm_overrideredirect, fix for Column/window element justification, new vertical_alignment parm for Columns, vertical_alignment parm added to Frame, vertical_alignment added to pin func"
version = __version__ = "4.28.0.11 Unreleased 3-Aug-2020\nAdded a referesh to visiblity_changed (an existing function but blank), added Column.contents_changed which will update the scrollbar so corrently match the contents, separators expand only in 1 direction now, added SYBOOLS for arrows circle square, dark grey 8 theme, when closing window don't delete the tkroot variable and rows but instead set to None, dark grey 9 theme, replaced check for darkwin with try/except for wm_overrideredirect, fix for Column/window element justification, new vertical_alignment parm for Columns, vertical_alignment parm added to Frame, vertical_alignment added to pin func, vtop/vcenter/vbottom vertical alignment layout helper funcs"
port = 'PySimpleGUI'
@ -9190,6 +9190,36 @@ def pin(elem, vertical_alignment=None):
return Column([[elem, Canvas(size=(0,0), pad=(0,0))]], pad=(0,0), vertical_alignment=vertical_alignment)
def vtop(elem):
'''
Aligh the element to the top of the row that contains it.
:param elem: the element to put into the layout
:return: A column element containing the provided element aligned to the top
'''
return Column([[elem]], pad=(0,0), vertical_alignment='top')
def vcenter(elem):
'''
Aligh the element to the center of the row that contains it.
:param elem: the element to put into the layout
:return: A column element containing the provided element aligned to the center
'''
return Column([[elem]], pad=(0,0), vertical_alignment='center')
def vbottom(elem):
'''
Aligh the element to the bottom of the row that contains it.
:param elem: the element to put into the layout
:return: A column element containing the provided element aligned to the bottom
'''
return Column([[elem]], pad=(0,0), vertical_alignment='bottom')
# ------------------------- FOLDER BROWSE Element lazy function ------------------------- #
def FolderBrowse(button_text='Browse', target=(ThisRow, -1), initial_folder=None, tooltip=None, size=(None, None),
auto_size_button=None, button_color=None, disabled=False, change_submits=False, enable_events=False,