diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index be3c6c92..873a96ce 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -3,18 +3,24 @@ import PySimpleGUI as sg sg.ChangeLookAndFeel('GreenTan') -form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False) +# ------ Menu Definition ------ # +menu_def = [['File', ['Open', 'Save', 'Exit', 'Properties']], + ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ], + ['Help', 'About...'], ] + + +# ------ Column Definition ------ # column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')], [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]] layout = [ + [sg.Menu(menu_def, tearoff=True)], [sg.Text('All graphic widgets in one form!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)], [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], - [sg.Frame(layout=[ [sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)], [sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN)], @@ -36,8 +42,14 @@ layout = [ [sg.Submit(), sg.Cancel()] ] -button, values = form.LayoutAndRead(layout) -sg.PopupAutoClose('Title', 'The results of the form.', 'The button clicked was "{}"'.format(button), 'The values are', values, auto_close_duration=1) +form = sg.FlexForm('Everything bagel', default_element_size=(40, 1), grab_anywhere=False).Layout(layout) + +button, values = form.Read() + +sg.Popup('Title', + 'The results of the form.', + 'The button clicked was "{}"'.format(button), + 'The values are', values) diff --git a/docs/index.md b/docs/index.md index af243158..e718ab5c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -73,6 +73,8 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) +![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python?? diff --git a/readme.md b/readme.md index af243158..e718ab5c 100644 --- a/readme.md +++ b/readme.md @@ -73,6 +73,8 @@ You can build an async media player GUI with custom buttons in 30 lines of code. ![media player 2](https://user-images.githubusercontent.com/13696193/44960091-eeebf980-aec6-11e8-884e-80d4447a83cd.jpg) +![pong](https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif) + ## Background I was frustrated by having to deal with the dos prompt when I had a powerful Windows machine right in front of me. Why is it SO difficult to do even the simplest of input/output to a window in Python??