Merge pull request #93 from MikeTheWatchGuy/Dev-latest

Automatically show code when item selected
This commit is contained in:
MikeTheWatchGuy 2018-08-30 10:56:14 -04:00 committed by GitHub
commit 98826869a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -787,8 +787,8 @@ multiline_elem = sg.Multiline(size=(70,35), do_not_clear=True)
while True: while True:
sg.ChangeLookAndFeel('LightGreen') sg.ChangeLookAndFeel('LightGreen')
col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), key='func')], col_listbox = [[sg.Listbox(values=listbox_values, size=(max(len(x) for x in listbox_values),len(listbox_values)), select_submits=True, key='func')],
[sg.SimpleButton('Run'), sg.ReadFormButton('Show Code'), sg.Exit()]] [sg.SimpleButton('Run'), sg.Exit()]]
layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))], layout = [[sg.Text('PySimpleGUI Coookbook', font=('current 18'))],
[sg.Column(col_listbox, pad=(5,(3,2))), multiline_elem], [sg.Column(col_listbox, pad=(5,(3,2))), multiline_elem],
@ -809,7 +809,7 @@ while True:
except: except:
continue continue
if button is 'Show Code': if button is '':
multiline_elem.Update(inspect.getsource(func)) multiline_elem.Update(inspect.getsource(func))
button, values = form.Read() button, values = form.Read()
elif button is 'Run': elif button is 'Run':