New statusbar demo to accompany change to StatusBar element.

This commit is contained in:
PySimpleGUI 2020-08-17 11:48:56 -04:00
parent 068a881662
commit d051a22a89
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,40 @@
import PySimpleGUI as sg
"""
Demo Status Bar
This demo shows you how to create your statusbar in a way that will keep it at the bottom of
a resizeable window. The key is the correct setting of the Expand settings for both the
StatusBar (done for you) and for a line above it that will keep it pushed to the bottom of the window.
It's possible to also "simulate" a statusbar (i.e. use a text element or something else) by also
configuring that element with the correct expand setting (X direction = True, expand row=True)
Copyright 2020 PySimpleGUI.org
"""
def main():
layout = [ [sg.Text('StatusBar Demo', font='ANY 15')],
[sg.Text('This window has a status bar that is at the bottom of the window')],
[sg.Text('The key to getting your bar to stay at the bottom of the window when')],
[sg.Text('the window is resizeed is to insert a line of text (or some other element)')],
[sg.Text('that is configured to expand. ')],
[sg.Text('This is accomplished by calling the "expand" method')],
[sg.Text('')],
[sg.Button('Ok'), sg.B('Quit')],
[sg.Text(key='-EXPAND-', font='ANY 1', pad=(0,0))], # thin row (font size 1) that expands and keeps bar at the bottom
[sg.StatusBar('This is the statusbar')]]
window = sg.Window('Vertical Layout Example', layout, resizable=True, finalize=True)
window['-EXPAND-'].expand(True, True, True) # needed to make the window expand in a way that will cause status to be at the bottom
while True:
event, values = window.read()
if event in (sg.WINDOW_CLOSED, 'Quit'): # if user closes window or clicks Quit
break
if __name__ == '__main__':
main()

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3 #!/usr/bin/python3
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" version = __version__ = "4.28.0.12 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, fixed statusbar expansion"
port = 'PySimpleGUI' port = 'PySimpleGUI'