From dc2f55dc9692fd35447a73a9d801fce49270a54e Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Sat, 10 Oct 2020 12:51:44 -0400 Subject: [PATCH] Moved Example 5B inside of Try/Except block in case unpacking isn't supported. --- DemoPrograms/Demo_Layout_Vertical.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/DemoPrograms/Demo_Layout_Vertical.py b/DemoPrograms/Demo_Layout_Vertical.py index bb9e6dd1..c882614c 100644 --- a/DemoPrograms/Demo_Layout_Vertical.py +++ b/DemoPrograms/Demo_Layout_Vertical.py @@ -71,11 +71,14 @@ def main(): # -------------------- Example 5B - Top align portion of a row -------------------- # Same operation as adding the 2 lists, but instead unpacks vtop list directly into a row layout - layout = [ [sg.T('This layout uses the "vtop" for first part of row')], - [*sg.vtop([sg.Text('On row 1'), sg.Listbox(list(range(10)), size=(5,4)), sg.Text('On row 1')]), sg.Text('More elements'), sg.CB('Last')], - [sg.Button('OK')] ] + try: + layout = [ [sg.T('This layout uses the "vtop" for first part of row')], + [*sg.vtop([sg.Text('On row 1'), sg.Listbox(list(range(10)), size=(5,4)), sg.Text('On row 1')]), sg.Text('More elements'), sg.CB('Last')], + [sg.Button('OK')] ] - sg.Window('Example 5B', layout).read(close=True) + sg.Window('Example 5B', layout).read(close=True) + except: + print('Your version of Python likely does not support unpacking inside of a list') # -------------------- Example 6 - Use function to align all rows in layout -------------------- layout = [ [sg.T('This layout has all rows top aligned using function')],