2018-09-08 02:13:15 +00:00
#!/usr/bin/env Python3
2018-08-18 21:22:38 +00:00
import PySimpleGUI as sg
2018-09-10 22:42:05 +00:00
sg . ChangeLookAndFeel ( ' GreenTan ' )
form = sg . FlexForm ( ' Everything bagel ' , default_element_size = ( 40 , 1 ) , grab_anywhere = False )
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 = [
2018-09-19 14:43:30 +00:00
[ sg . Text ( ' All graphic widgets in one form! ' , size = ( 30 , 1 ) , justification = ' center ' , font = ( " Helvetica " , 25 ) , relief = sg . RELIEF_RIDGE ) ] ,
2018-09-10 22:42:05 +00:00
[ sg . Text ( ' Here is some text.... and a place to enter text ' ) ] ,
[ sg . InputText ( ' This is my text ' ) ] ,
2018-09-18 16:05:44 +00:00
2018-09-19 13:36:17 +00:00
[ sg . Frame ( layout = [
2018-09-10 22:42:05 +00:00
[ sg . Checkbox ( ' Checkbox ' ) , sg . Checkbox ( ' My second checkbox! ' , default = True ) ] ,
2018-09-19 14:43:30 +00:00
[ sg . Radio ( ' My first Radio! ' , " RADIO1 " , default = True ) , sg . Radio ( ' My second Radio! ' , " RADIO1 " ) ] ] , title = ' Options ' , title_color = ' red ' , relief = sg . RELIEF_SUNKEN ) ] ,
2018-09-10 22:42:05 +00:00
[ sg . Multiline ( default_text = ' This is the default Text should you decide not to type anything ' , size = ( 35 , 3 ) ) ,
sg . Multiline ( default_text = ' A second multi-line ' , size = ( 35 , 3 ) ) ] ,
[ sg . InputCombo ( ( ' Combobox 1 ' , ' Combobox 2 ' ) , size = ( 20 , 1 ) ) ,
sg . Slider ( range = ( 1 , 100 ) , orientation = ' h ' , size = ( 34 , 20 ) , default_value = 85 ) ] ,
[ sg . InputOptionMenu ( ( ' Menu Option 1 ' , ' Menu Option 2 ' , ' Menu Option 3 ' ) ) ] ,
[ sg . Listbox ( values = ( ' Listbox 1 ' , ' Listbox 2 ' , ' Listbox 3 ' ) , size = ( 30 , 3 ) ) ,
2018-09-19 13:36:17 +00:00
sg . Frame ( ' Labelled Group ' , [ [
2018-09-10 22:42:05 +00:00
sg . Slider ( range = ( 1 , 100 ) , orientation = ' v ' , size = ( 5 , 20 ) , default_value = 25 ) ,
sg . Slider ( range = ( 1 , 100 ) , orientation = ' v ' , size = ( 5 , 20 ) , default_value = 75 ) ,
sg . Slider ( range = ( 1 , 100 ) , orientation = ' v ' , size = ( 5 , 20 ) , default_value = 10 ) ,
2018-09-19 13:36:17 +00:00
sg . Column ( column1 , background_color = ' #F7F3EC ' ) ] ] ) ] ,
2018-09-10 22:42:05 +00:00
[ sg . Text ( ' _ ' * 80 ) ] ,
[ sg . Text ( ' Choose A Folder ' , size = ( 35 , 1 ) ) ] ,
[ sg . Text ( ' Your Folder ' , size = ( 15 , 1 ) , auto_size_text = False , justification = ' right ' ) ,
sg . InputText ( ' Default Folder ' ) , sg . FolderBrowse ( ) ] ,
[ sg . Submit ( ) , sg . Cancel ( ) ]
]
button , values = form . LayoutAndRead ( layout )
2018-09-18 16:05:44 +00:00
sg . PopupAutoClose ( ' Title ' , ' The results of the form. ' , ' The button clicked was " {} " ' . format ( button ) , ' The values are ' , values , auto_close_duration = 1 )
2018-09-10 22:42:05 +00:00
2018-08-18 21:22:38 +00:00