From 10ec6a11ae3b0c988c9edb924d3fd619364da53f Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 6 Oct 2018 01:05:25 -0400 Subject: [PATCH 1/2] NEW demo program - SDK Quick Reference --- Demo_PSG_SDK_Quick_Ref.py | 85 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Demo_PSG_SDK_Quick_Ref.py diff --git a/Demo_PSG_SDK_Quick_Ref.py b/Demo_PSG_SDK_Quick_Ref.py new file mode 100644 index 00000000..aa4c1e57 --- /dev/null +++ b/Demo_PSG_SDK_Quick_Ref.py @@ -0,0 +1,85 @@ +import PySimpleGUI as sg + +element_list = ('Text', + 'InputText', + 'CheckBox', + 'RadioButton', + 'Listbox', + 'Slider', + 'Multiline', + 'Output', + 'ProgressBar', + 'OptionMenu', + 'Menu', + 'Frame', + 'Column', + 'Graph', + 'Image', + 'Table', + 'Tab', + 'TabGroup') + +desc_text = """ +Text( text + size=(None, None) + auto_size_text=None + click_submits=None + relief=None + font=None + text_color=None + background_color=None + justification=None + pad=None + key=None + tooltip=None)""" + +desc_inputtext = """ +InputText( default_text ='' + size=(None, None) + auto_size_text=None + password_char='' + justification=None + background_color=None + text_color=None + font=None + tooltip=None + do_not_clear=False + key=None + focus=False + pad=None) +""" + +desc_checkbox = """ +CheckBox( text, + default=False + size=(None, None) + auto_size_text=None + font=None + background_color=None + text_color=None + change_submits=False + key=None + pad=None + tooltip=None) +""" + + +descriptions = {'Text':desc_text, 'InputText':desc_inputtext, 'CheckBox':desc_checkbox} + +layout = [[sg.Text('Persistent window')], + [sg.Listbox(values=element_list, size=(15,len(element_list)), key='_in_', change_submits=True), + sg.Text(desc_text, size=(40,15),font=('Consolas 13'), key='_out_')], + [sg.RButton('Read'), sg.Exit()]] + +window = sg.Window('Window that stays open').Layout(layout) + +while True: + button, values = window.Read() + if button is None or button == 'Exit': + break + element = values['_in_'][0] + try: + desc = descriptions[element] + except: desc = '' + window.FindElement('_out_').Update(desc) + print(button, values) \ No newline at end of file From 22ff47dc2491c9c5c7c08469ba5b1f038f83eafc Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Sat, 6 Oct 2018 01:08:01 -0400 Subject: [PATCH 2/2] Update Demo_PSG_SDK_Quick_Ref.py --- Demo_PSG_SDK_Quick_Ref.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Demo_PSG_SDK_Quick_Ref.py b/Demo_PSG_SDK_Quick_Ref.py index aa4c1e57..4c04e06c 100644 --- a/Demo_PSG_SDK_Quick_Ref.py +++ b/Demo_PSG_SDK_Quick_Ref.py @@ -66,12 +66,13 @@ CheckBox( text, descriptions = {'Text':desc_text, 'InputText':desc_inputtext, 'CheckBox':desc_checkbox} -layout = [[sg.Text('Persistent window')], +layout = [[sg.Text('The PySimpleGUI SDK Quick Reference Guide',font='Any 15', relief=sg.RELIEF_RAISED)], [sg.Listbox(values=element_list, size=(15,len(element_list)), key='_in_', change_submits=True), - sg.Text(desc_text, size=(40,15),font=('Consolas 13'), key='_out_')], + sg.Text(desc_text, size=(40,15),font=('Consolas 13'), text_color='darkblue', key='_out_')], [sg.RButton('Read'), sg.Exit()]] -window = sg.Window('Window that stays open').Layout(layout) +window = sg.Window('Window that stays open', + font = 'Any 12').Layout(layout) while True: button, values = window.Read()