From 9b33a4cf87ff7a5c0325d2cc2ca364d9cbc9e88c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 19 Sep 2018 09:36:17 -0400 Subject: [PATCH] Fix for Menu Tearoff, fixed Demo All Widgets --- Demo_All_Widgets.py | 8 ++++---- PySimpleGUI.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Demo_All_Widgets.py b/Demo_All_Widgets.py index ca10c88d..4432c206 100644 --- a/Demo_All_Widgets.py +++ b/Demo_All_Widgets.py @@ -15,20 +15,20 @@ layout = [ [sg.Text('Here is some text.... and a place to enter text')], [sg.InputText('This is my text')], - [sg.Frame([ + [sg.Frame(layout=[ [sg.Checkbox('Checkbox'), sg.Checkbox('My second checkbox!', default=True)], - [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")]], title='Options',text_color='red', relief=sg.RELIEF_RAISED)], + [sg.Radio('My first Radio! ', "RADIO1", default=True), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_RAISED)], [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)), - sg.Frame([[ + sg.Frame('Labelled Group',[[ 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), - sg.Column(column1, background_color='#F7F3EC')]],'Labelled Group', text_color='purple')], + sg.Column(column1, background_color='#F7F3EC')]])], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))], [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'), diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 564db563..bb07d523 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2404,7 +2404,7 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) item = sub_menu_info[i] if i != len(sub_menu_info) - 1: if type(sub_menu_info[i+1]) == list: - new_menu = tk.Menu(top_menu) + new_menu = tk.Menu(top_menu, tearoff=element.Tearoff) top_menu.add_cascade(label=sub_menu_info[i], menu=new_menu) AddMenuItem(new_menu, sub_menu_info[i+1], element, is_sub_menu=True) i += 1 # skip the next one @@ -2898,12 +2898,12 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): column_widths = {} for row in element.Values: for i,col in enumerate(row): - col_len = min(len(str(col)), element.MaxColumnWidth) + col_width = min(len(str(col)), element.MaxColumnWidth) try: - if col_len > column_widths[i]: - column_widths[i] = col_len + if col_width > column_widths[i]: + column_widths[i] = col_width except: - column_widths[i] = col_len + column_widths[i] = col_width if element.ColumnsToDisplay is None: displaycolumns = element.ColumnHeadings else: