From d051a22a8975521afd2429f299240e9f47712d94 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Mon, 17 Aug 2020 11:48:56 -0400 Subject: [PATCH] New statusbar demo to accompany change to StatusBar element. --- DemoPrograms/Demo_Status_Bar.py | 40 +++++++++++++++++++++++++++++++++ PySimpleGUI.py | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 DemoPrograms/Demo_Status_Bar.py diff --git a/DemoPrograms/Demo_Status_Bar.py b/DemoPrograms/Demo_Status_Bar.py new file mode 100644 index 00000000..bdf49687 --- /dev/null +++ b/DemoPrograms/Demo_Status_Bar.py @@ -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() + diff --git a/PySimpleGUI.py b/PySimpleGUI.py index db5e1ceb..d1ef38db 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,5 +1,5 @@ #!/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'