Fix for Menu Tearoff, fixed Demo All Widgets

This commit is contained in:
MikeTheWatchGuy 2018-09-19 09:36:17 -04:00
parent e02ca3ba14
commit 9b33a4cf87
2 changed files with 9 additions and 9 deletions

View File

@ -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'),

View File

@ -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: