From 8f220a7ac19696be5a88a3eaef12690ff39859f8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 Aug 2018 13:18:04 -0400 Subject: [PATCH] Refresh of Demo applications --- Demo_Compare_Files.py | 2 +- Demo_GoodColors.py | 10 +++--- Demo_HowDoI.py | 31 +++++++++------- Demo_Machine_Learning.py | 50 ++++++++++++++++++++++++++ Demo_Media_Player.py | 16 +++++---- Demo_NonBlocking_Form.py | 22 +++--------- Demo_Pi_Robotics.py | 2 +- Demo_Recipes.py | 75 +++++++++++++++++++++------------------ Demo_Super_Simple_Form.py | 18 ++++++---- 9 files changed, 139 insertions(+), 87 deletions(-) create mode 100644 Demo_Machine_Learning.py diff --git a/Demo_Compare_Files.py b/Demo_Compare_Files.py index 25077a9a..c5ecf7f2 100644 --- a/Demo_Compare_Files.py +++ b/Demo_Compare_Files.py @@ -1,7 +1,7 @@ import PySimpleGUI as sg def GetFilesToCompare(): - with sg.FlexForm('File Compare', auto_size_text=True) as form: + with sg.FlexForm('File Compare') as form: form_rows = [[sg.Text('Enter 2 files to comare')], [sg.Text('File 1', size=(15, 1)), sg.InputText(), sg.FileBrowse()], [sg.Text('File 2', size=(15, 1)), sg.InputText(), sg.FileBrowse()], diff --git a/Demo_GoodColors.py b/Demo_GoodColors.py index 7d0402f8..f1c0a09c 100644 --- a/Demo_GoodColors.py +++ b/Demo_GoodColors.py @@ -9,33 +9,33 @@ def main(): #===== Show some nice BLUE colors with yellow text ===== ===== ===== ===== ===== ===== =====# text_color = gg.YELLOWS[0] - buttons = (gg.SimpleButton(f'BLUES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) + buttons = (gg.SimpleButton('BLUES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.BLUES)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.BLUES')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice PURPLE colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.SimpleButton(f'PURPLES[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) + buttons = (gg.SimpleButton('PURPLES[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.PURPLES)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.PURPLES')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice GREEN colors with yellow text ===== ===== ===== ===== ===== ===== =====# - buttons = (gg.SimpleButton(f'GREENS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) + buttons = (gg.SimpleButton('GREENS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.GREENS)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.GREENS')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice TAN colors with yellow text ===== ===== ===== ===== ===== ===== =====# text_color = gg.GREENS[0] # let's use GREEN text on the tan - buttons = (gg.SimpleButton(f'TANS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) + buttons = (gg.SimpleButton('TANS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.TANS)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.TANS')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) #===== Show some nice YELLOWS colors with black text ===== ===== ===== ===== ===== ===== =====# text_color = 'black' # let's use black text on the tan - buttons = (gg.SimpleButton(f'YELLOWS[{j}]\n{c}', button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) + buttons = (gg.SimpleButton('YELLOWS[{}]\n{}'.format(j, c), button_color=(text_color, c), size=(10,2)) for j, c in enumerate(gg.YELLOWS)) form.AddRow(gg.T('Button Colors Using PySimpleGUI.YELLOWS')) form.AddRow(*buttons) form.AddRow(gg.Text('_' * 100, size=(65, 1))) diff --git a/Demo_HowDoI.py b/Demo_HowDoI.py index 257a0656..2d260e8b 100644 --- a/Demo_HowDoI.py +++ b/Demo_HowDoI.py @@ -1,9 +1,9 @@ -import PySimpleGUI as SG +import PySimpleGUI as sg import subprocess import howdoi # Test this command in a dos window if you are having trouble. -HOW_DO_I_COMMAND = 'python -m howdoi.howdoi' +HOW_DO_I_COMMAND = 'python -m howdoi.howdoi -n 2' # if you want an icon on your taskbar for this gui, then change this line of code to point to the ICO file DEFAULT_ICON = 'E:\\TheRealMyDocs\\Icons\\QuestionMark.ico' @@ -18,25 +18,29 @@ def HowDoI(): ''' # ------- Make a new FlexForm ------- # # Set system-wide options that will affect all future forms. Give our form a spiffy look and feel - SG.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white','#475841')) - form = SG.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) - form.AddRow(SG.Text('Ask and your answer will appear here....', size=(40, 1))) - form.AddRow(SG.Output(size=(90, 20))) - form.AddRow(SG.Multiline(size=(85, 5), enter_submits=True), - SG.ReadFormButton('SEND', button_color=(SG.YELLOWS[0], SG.BLUES[0])), - SG.SimpleButton('EXIT', button_color=(SG.YELLOWS[0], SG.GREENS[0]))) - + sg.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white', '#475841')) + form = sg.FlexForm('How Do I ??', auto_size_text=True, default_element_size=(30, 2), icon=DEFAULT_ICON) + layout = [ + [sg.Text('Ask and your answer will appear here....', size=(40, 1))], + [sg.Output(size=(88, 20))], + [ sg.Spin(values=(1, 2, 3, 4), initial_value=1, size=(2, 1), key='Num Answers'), sg.T('Num Answers'), sg.Checkbox('Display Full Text', key='full text')], + [sg.Multiline(size=(85, 5), enter_submits=True, key='query'), + sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True), + sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))] + ] + form.Layout(layout) # ---===--- Loop taking in user input and using it to query HowDoI --- # while True: (button, value) = form.Read() + if button == 'SEND': - QueryHowDoI(value[0][:-1]) # send string without carriage return on end + QueryHowDoI(value['query'], value['Num Answers'], value['full text']) # send string without carriage return on end else: break # exit button clicked exit(69) -def QueryHowDoI(Query): +def QueryHowDoI(Query, num_answers, full_text): ''' Kicks off a subprocess to send the 'Query' to HowDoI Prints the result, which in this program will route to a gooeyGUI window @@ -44,7 +48,8 @@ def QueryHowDoI(Query): :return: nothing ''' howdoi_command = HOW_DO_I_COMMAND - t = subprocess.Popen(howdoi_command + ' '+ Query, stdout=subprocess.PIPE) + full_text_option = ' -a' if full_text else '' + t = subprocess.Popen(howdoi_command + ' '+ Query + ' -n ' + str(num_answers)+full_text_option, stdout=subprocess.PIPE) (output, err) = t.communicate() print('You asked: '+ Query) print('_______________________________________') diff --git a/Demo_Machine_Learning.py b/Demo_Machine_Learning.py new file mode 100644 index 00000000..6de6283f --- /dev/null +++ b/Demo_Machine_Learning.py @@ -0,0 +1,50 @@ +import PySimpleGUI as sg + +def MachineLearningGUI(): + sg.SetOptions(text_justification='right') + form = sg.FlexForm('Machine Learning Front End', font=("Helvetica", 12)) # begin with a blank form + + layout = [[sg.Text('Machine Learning Command Line Parameters', font=('Helvetica', 16))], + [sg.Text('Passes', size=(15, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1)), + sg.Text('Steps', size=(18, 1)), sg.Spin(values=[i for i in range(1, 1000)], initial_value=20, size=(6, 1))], + [sg.Text('ooa', size=(15, 1)), sg.In(default_text='6', size=(10, 1)), sg.Text('nn', size=(15, 1)), sg.In(default_text='10', size=(10, 1))], + [sg.Text('q', size=(15, 1)), sg.In(default_text='ff', size=(10, 1)), sg.Text('ngram', size=(15, 1)), sg.In(default_text='5', size=(10, 1))], + [sg.Text('l', size=(15, 1)), sg.In(default_text='0.4', size=(10, 1)), sg.Text('Layers', size=(15, 1)), sg.Drop(values=('BatchNorm', 'other'),auto_size_text=True)], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Flags', font=('Helvetica', 15), justification='left')], + [sg.Checkbox('Normalize', size=(12, 1), default=True), sg.Checkbox('Verbose', size=(20, 1))], + [sg.Checkbox('Cluster', size=(12, 1)), sg.Checkbox('Flush Output', size=(20, 1), default=True)], + [sg.Checkbox('Write Results', size=(12, 1)), sg.Checkbox('Keep Intermediate Data', size=(20, 1))], + [sg.Text('_' * 100, size=(65, 1))], + [sg.Text('Loss Functions', font=('Helvetica', 15), justification='left')], + [sg.Radio('Cross-Entropy', 'loss', size=(12, 1)), sg.Radio('Logistic', 'loss', default=True, size=(12, 1))], + [sg.Radio('Hinge', 'loss', size=(12, 1)), sg.Radio('Huber', 'loss', size=(12, 1))], + [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], + [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], + [sg.Submit(), sg.Cancel()]] + button, values = form.LayoutAndRead(layout) + del(form) + sg.SetOptions(text_justification='left') + + return button, values + + +def CustomMeter(): + + progress_bar = sg.ProgressBar(10000, orientation='h', size=(20,20)) + + layout = [[sg.Text('A custom progress meter')], + [progress_bar], + [sg.Cancel()]] + + form = sg.FlexForm('Custom Progress Meter') + form.LayoutAndRead(layout, non_blocking=True) + + for i in range(10000): + button, values = form.ReadNonBlocking() + progress_bar.UpdateBar(i) + + +if __name__ == '__main__': + CustomMeter() + MachineLearningGUI() diff --git a/Demo_Media_Player.py b/Demo_Media_Player.py index fdc01434..87e5586e 100644 --- a/Demo_Media_Player.py +++ b/Demo_Media_Player.py @@ -7,7 +7,9 @@ import PySimpleGUI as sg # https://user-images.githubusercontent.com/13696193/43159403-45c9726e-8f50-11e8-9da0-0d272e20c579.jpg # def MediaPlayerGUI(): - + background = '#F0F0F0' + # Set the backgrounds the same as the background on the buttons + sg.SetOptions(background_color=background, element_background_color=background) # Images are located in a subfolder in the Demo Media Player.py folder image_pause = './ButtonGraphics/Pause.png' image_restart = './ButtonGraphics/Restart.png' @@ -22,18 +24,18 @@ def MediaPlayerGUI(): font=("Helvetica", 25)) # define layout of the rows layout= [[sg.Text('Media File Player',size=(17,1), font=("Helvetica", 25))], - [TextElem], - [sg.ReadFormButton('Restart Song', button_color=sg.TRANSPARENT_BUTTON, + [TextElem], + [sg.ReadFormButton('Restart Song', button_color=(background,background), image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.ReadFormButton('Pause', button_color=sg.TRANSPARENT_BUTTON, + sg.ReadFormButton('Pause', button_color=(background,background), image_filename=image_pause, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.ReadFormButton('Next', button_color=sg.TRANSPARENT_BUTTON, + sg.ReadFormButton('Next', button_color=(background,background), image_filename=image_next, image_size=(50, 50), image_subsample=2, border_width=0), sg.Text(' ' * 2), - sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=sg.TRANSPARENT_BUTTON, - image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], + sg.Text(' ' * 2), sg.SimpleButton('Exit', button_color=(background,background), + image_filename=image_exit, image_size=(50, 50), image_subsample=2, border_width=0)], [sg.Text('_'*30)], [sg.Text(' '*30)], [ diff --git a/Demo_NonBlocking_Form.py b/Demo_NonBlocking_Form.py index 6121e725..79693a25 100644 --- a/Demo_NonBlocking_Form.py +++ b/Demo_NonBlocking_Form.py @@ -44,18 +44,14 @@ def StatusOutputExample(): def RemoteControlExample(): # Make a form, but don't use context manager - form = sg.FlexForm('Running Timer', auto_size_text=True) - # Create a text element that will be updated with status information on the GUI itself - output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center') - + form = sg.FlexForm('Robotics Remote Control', auto_size_text=True) form_rows = [[sg.Text('Robotics Remote Control')], - [output_element], [sg.T(' '*10), sg.RealtimeButton('Forward')], [ sg.RealtimeButton('Left'), sg.T(' '*15), sg.RealtimeButton('Right')], [sg.T(' '*10), sg.RealtimeButton('Reverse')], [sg.T('')], - [sg.Quit()] + [sg.Quit(button_color=('black', 'orange'))] ] form.LayoutAndRead(form_rows, non_blocking=True) @@ -66,25 +62,15 @@ def RemoteControlExample(): # else it won't refresh. # # your program's main loop - i=0 while (True): # This is the code that reads and updates your window - output_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) button, values = form.ReadNonBlocking() if button is not None: - print(button) + sg.Print(button) if button == 'Quit' or values is None: break - if button == 'LED On': - print('Turning on the LED') - elif button == 'LED Off': - print('Turning off the LED') + # time.sleep(.01) - i += 1 - # Your code begins here - time.sleep(.01) - - # Broke out of main loop. Close the window. form.CloseNonBlockingForm() diff --git a/Demo_Pi_Robotics.py b/Demo_Pi_Robotics.py index e04d5458..607fa366 100644 --- a/Demo_Pi_Robotics.py +++ b/Demo_Pi_Robotics.py @@ -88,7 +88,7 @@ def RemoteControlExample_NoGraphics(): def main(): RemoteControlExample_NoGraphics() # Uncomment to get the fancy graphics version. Be sure and download the button images! - # RemoteControlExample() + RemoteControlExample() sg.MsgBox('End of non-blocking demonstration') if __name__ == '__main__': diff --git a/Demo_Recipes.py b/Demo_Recipes.py index 9653247f..d34fac49 100644 --- a/Demo_Recipes.py +++ b/Demo_Recipes.py @@ -5,10 +5,10 @@ import PySimpleGUI as sg # A simple blocking form. Your best starter-form def SourceDestFolders(): with sg.FlexForm('Demo Source / Destination Folders') as form: - form_rows = [[sg.Text('Enter the Source and Destination folders')], + form_rows = ([sg.Text('Enter the Source and Destination folders')], [sg.Text('Source Folder', size=(15, 1), justification='right'), sg.InputText('Source'), sg.FolderBrowse()], [sg.Text('Destination Folder', size=(15, 1), justification='right'), sg.InputText('Dest'), sg.FolderBrowse()], - [sg.Submit(), sg.Cancel()]] + [sg.Submit(), sg.Cancel()]) button, (source, dest) = form.LayoutAndRead(form_rows) if button == 'Submit': @@ -39,7 +39,7 @@ def MachineLearningGUI(): [sg.Radio('Kullerback', 'loss', size=(12, 1)), sg.Radio('MAE(L1)', 'loss', size=(12, 1))], [sg.Radio('MSE(L2)', 'loss', size=(12, 1)), sg.Radio('MB(L0)', 'loss', size=(12, 1))], [sg.Submit(), sg.Cancel()]] - button, values = form.LayoutAndShow(layout) + button, values = form.LayoutAndRead(layout) del(form) sg.SetOptions(text_justification='left') @@ -70,10 +70,8 @@ def Everything(): sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10), sg.Spin(values=('Spin Box 1', '2','3'), initial_value='Spin Box 1')], [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(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))] - ] + [sg.Submit(), sg.Cancel(), sg.SimpleButton('Customized', button_color=('black', '#EDE5B7'))] ] button, values = form.LayoutAndRead(layout) @@ -113,8 +111,8 @@ def Everything_NoContextManager(): def ProgressMeter(): - for i in range(1,100): - if not sg.EasyProgressMeter('My Meter', i + 1, 100, orientation='v'): break + for i in range(1,1000): + if not sg.EasyProgressMeter('My Meter', i + 1, 1000, orientation='h'): break time.sleep(.01) # Blocking form that doesn't close @@ -122,7 +120,7 @@ def ChatBot(): with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form: layout = [[(sg.Text('This is where standard out is being routed', size=[40, 1]))], [sg.Output(size=(80, 20))], - [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0])), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] + [sg.Multiline(size=(70, 5), enter_submits=True), sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True), sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]] # notice this is NOT the usual LayoutAndRead call because you don't yet want to read the form # if you call LayoutAndRead from here, then you will miss the first button click form.Layout(layout) @@ -181,39 +179,46 @@ def NonBlockingPeriodicUpdateForm(): def DebugTest(): # SG.Print('How about we print a bunch of random numbers?', , size=(90,40)) for i in range (1,300): - sg.Print(i, randint(1, 1000), end='', sep='-') + sg.Print('Here are 300 random numbers', i, randint(1, 1000), sep='-') + +# Change the colors and set borders to 0 for a flat look +def ChangeLookAndFeel(colors): + sg.SetOptions(background_color=colors['BACKGROUND'], + text_element_background_color=colors['BACKGROUND'], + element_background_color=colors['BACKGROUND'], + text_color=colors['TEXT'], + input_elements_background_color=colors['INPUT'], + button_color=colors['BUTTON'], + progress_meter_color=colors['PROGRESS'], + border_width=0, + slider_border_width=0, + progress_meter_border_depth=0, + scrollbar_color=(colors['INPUT']), + element_text_color=colors['TEXT']) #=---------------------------------- main ------------------------------ def main(): - # sg.MsgBox('Changing look and feel.', 'Done by calling SetOptions') - SourceDestFolders() - - sg.SetOptions(background_color='#9FB8AD', text_element_background_color='#9FB8AD', element_background_color='#9FB8AD', scrollbar_color=None, input_elements_background_color='#F7F3EC', button_color=('white','#475841'), border_width=0, slider_border_width=0, progress_meter_border_depth=0) - - MachineLearningGUI() - - Everything_NoContextManager() - - # sg.SetOptions(background_color='#B89FB6', text_element_background_color='#B89FB6', element_background_color='#B89FB6', button_color=('white','#7E6C92'), text_color='#3F403F',border_width=0, slider_border_width=0, progress_meter_border_depth=0) - - sg.SetOptions(background_color='#A5CADD', input_elements_background_color='#E0F5FF', text_element_background_color='#A5CADD', element_background_color='#A5CADD', button_color=('white','#303952'), text_color='#822E45',border_width=0, progress_meter_color=('#3D8255','white'), slider_border_width=0, progress_meter_border_depth=0) - - Everything() - - ProgressMeter() - - # Set system-wide options that will affect all future forms - - - NonBlockingPeriodicUpdateForm_ContextManager() - - - NonBlockingPeriodicUpdateForm() - + # Green & tan color scheme + colors1 = {'BACKGROUND' : '#9FB8AD', 'TEXT': sg.COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC', 'BUTTON': ('white', '#475841'),'PROGRESS':sg.DEFAULT_PROGRESS_BAR_COLOR } + # light green with tan + colors2 = {'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7', 'BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')} + # blue with light blue color scheme + colors3 = {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF', 'BUTTON': ('white', '#303952'),'PROGRESS':sg.DEFAULT_PROGRESS_BAR_COLOR} ChatBot() + Everything() + SourceDestFolders() + ChangeLookAndFeel(colors2) + ProgressMeter() + ChangeLookAndFeel(colors3) + Everything() + ChangeLookAndFeel(colors2) + MachineLearningGUI() + Everything_NoContextManager() + NonBlockingPeriodicUpdateForm_ContextManager() + NonBlockingPeriodicUpdateForm() DebugTest() sg.MsgBox('Done with all recipes') diff --git a/Demo_Super_Simple_Form.py b/Demo_Super_Simple_Form.py index 0d13708e..54726258 100644 --- a/Demo_Super_Simple_Form.py +++ b/Demo_Super_Simple_Form.py @@ -2,12 +2,16 @@ import PySimpleGUI as sg form = sg.FlexForm('Simple data entry form') # begin with a blank form -layout = [[sg.Text('Please enter your Name, Address, Phone')], - [sg.Text('Name', size=(15, 1)), sg.InputText()], - [sg.Text('Address', size=(15, 1)), sg.InputText()], - [sg.Text('Phone', size=(15, 1)), sg.InputText()], - [sg.Submit(), sg.Cancel()]] +layout = [ + [sg.Text('Please enter your Name, Address, Phone')], + [sg.Text('Name', size=(15, 1)), sg.InputText('1', key='name')], + [sg.Text('Address', size=(15, 1)), sg.InputText('2', key='address')], + [sg.Text('Phone', size=(15, 1)), sg.InputText('3', key='phone')], + [sg.Submit(), sg.Cancel()] + ] -button, (name, address, phone) = form.LayoutAndRead(layout) +button, values = form.LayoutAndRead(layout) -print(name, address, phone) \ No newline at end of file +sg.MsgBox(button, values['name'], values['address'], values['phone']) + +print(values)