diff --git a/Demo_Tabs.py b/Demo_Tabs.py index 17bb3634..a90fbff3 100644 --- a/Demo_Tabs.py +++ b/Demo_Tabs.py @@ -11,11 +11,12 @@ tab6_layout = [[sg.T('This is inside tab 6')], [sg.T('How about a second row of stuff in tab 6?')]] layout = [[sg.T('My Window!')], - [sg.MultiTab([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.MultiTab([[sg.Tab('Tab 3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])], + [sg.TabGroup([[sg.Tab('Tab 1', tab1_layout), sg.Tab('Tab 2', tab2_layout)]]), sg.TabGroup([[sg.Tab('Tab 3', tab3_layout), sg.Tab('Tab 4', tab4_layout)]])], [sg.T('Text in the middle of the mess')], - [sg.MultiTab([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], + [sg.TabGroup([[sg.Tab('Tab 5', tab5_layout), sg.Tab('Tab 6', tab6_layout)]])], [sg.RButton('Read')], ] + window = sg.Window('My window with tabs').Layout(layout) while True: diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 76ee4e2e..4abd02f3 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1447,9 +1447,9 @@ class Tab(Element): # ---------------------------------------------------------------------- # -# MultiTab # +# TabGroup # # ---------------------------------------------------------------------- # -class MultiTab(Element): +class TabGroup(Element): def __init__(self, layout, title_color=None, background_color=None, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None): self.UseDictionary = False @@ -3173,7 +3173,6 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): PackFormIntoFrame(element, element.TKFrame, toplevel_form) form.TKNotebook.add(element.TKFrame, text=element.Title) form.TKNotebook.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1]) - # form.TKNotebook.pack(row=0, sticky=tk.NW) # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: # element.TKFrame.configure(background=element.BackgroundColor, @@ -3181,28 +3180,28 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): # highlightcolor=element.BackgroundColor) # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: # element.TKFrame.configure(foreground=element.TextColor) - # if element.BorderWidth is not None: - # element.TKFrame.configure(borderwidth=element.BorderWidth) - # if element.Tooltip is not None: - # element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip, - # timeout=DEFAULT_TOOLTIP_TIME) + if element.BorderWidth is not None: + element.TKFrame.configure(borderwidth=element.BorderWidth) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip, + timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- MultiTab element ------------------------- # elif element_type == ELEM_TYPE_MULTI_TAB: element.TKNotebook = ttk.Notebook(tk_row_frame) PackFormIntoFrame(element, toplevel_form.TKroot, toplevel_form) # element.TKNotebook.pack(side=tk.LEFT) - # if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: - # element.TKNotebook.configure(background=element.BackgroundColor, - # highlightbackground=element.BackgroundColor, - # highlightcolor=element.BackgroundColor) - # if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: - # element.TKNotebook.configure(foreground=element.TextColor) - # if element.BorderWidth is not None: - # element.TKNotebook.configure(borderwidth=element.BorderWidth) - # if element.Tooltip is not None: - # element.TooltipObject = ToolTip(element.TKNotebook, text=element.Tooltip, - # timeout=DEFAULT_TOOLTIP_TIME) + if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None: + element.TKNotebook.configure(background=element.BackgroundColor, + highlightbackground=element.BackgroundColor, + highlightcolor=element.BackgroundColor) + if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None: + element.TKNotebook.configure(foreground=element.TextColor) + if element.BorderWidth is not None: + element.TKNotebook.configure(borderwidth=element.BorderWidth) + if element.Tooltip is not None: + element.TooltipObject = ToolTip(element.TKNotebook, text=element.Tooltip, + timeout=DEFAULT_TOOLTIP_TIME) # ------------------------- SLIDER Box element ------------------------- # elif element_type == ELEM_TYPE_INPUT_SLIDER: slider_length = element_size[0] * CharWidthInPixels()