Merge pull request #335 from MikeTheWatchGuy/Dev-latest
Renamed MultiTab to TabGroup
This commit is contained in:
commit
952a66fd78
|
@ -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?')]]
|
[sg.T('How about a second row of stuff in tab 6?')]]
|
||||||
|
|
||||||
layout = [[sg.T('My Window!')],
|
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.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')],
|
[sg.RButton('Read')],
|
||||||
]
|
]
|
||||||
|
|
||||||
window = sg.Window('My window with tabs').Layout(layout)
|
window = sg.Window('My window with tabs').Layout(layout)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -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):
|
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
|
self.UseDictionary = False
|
||||||
|
@ -3173,7 +3173,6 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
||||||
PackFormIntoFrame(element, element.TKFrame, toplevel_form)
|
PackFormIntoFrame(element, element.TKFrame, toplevel_form)
|
||||||
form.TKNotebook.add(element.TKFrame, text=element.Title)
|
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(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:
|
# if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None:
|
||||||
# element.TKFrame.configure(background=element.BackgroundColor,
|
# element.TKFrame.configure(background=element.BackgroundColor,
|
||||||
|
@ -3181,28 +3180,28 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
||||||
# highlightcolor=element.BackgroundColor)
|
# highlightcolor=element.BackgroundColor)
|
||||||
# if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None:
|
# if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None:
|
||||||
# element.TKFrame.configure(foreground=element.TextColor)
|
# element.TKFrame.configure(foreground=element.TextColor)
|
||||||
# if element.BorderWidth is not None:
|
if element.BorderWidth is not None:
|
||||||
# element.TKFrame.configure(borderwidth=element.BorderWidth)
|
element.TKFrame.configure(borderwidth=element.BorderWidth)
|
||||||
# if element.Tooltip is not None:
|
if element.Tooltip is not None:
|
||||||
# element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip,
|
element.TooltipObject = ToolTip(element.TKFrame, text=element.Tooltip,
|
||||||
# timeout=DEFAULT_TOOLTIP_TIME)
|
timeout=DEFAULT_TOOLTIP_TIME)
|
||||||
# ------------------------- MultiTab element ------------------------- #
|
# ------------------------- MultiTab element ------------------------- #
|
||||||
elif element_type == ELEM_TYPE_MULTI_TAB:
|
elif element_type == ELEM_TYPE_MULTI_TAB:
|
||||||
element.TKNotebook = ttk.Notebook(tk_row_frame)
|
element.TKNotebook = ttk.Notebook(tk_row_frame)
|
||||||
PackFormIntoFrame(element, toplevel_form.TKroot, toplevel_form)
|
PackFormIntoFrame(element, toplevel_form.TKroot, toplevel_form)
|
||||||
|
|
||||||
# element.TKNotebook.pack(side=tk.LEFT)
|
# element.TKNotebook.pack(side=tk.LEFT)
|
||||||
# if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None:
|
if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None:
|
||||||
# element.TKNotebook.configure(background=element.BackgroundColor,
|
element.TKNotebook.configure(background=element.BackgroundColor,
|
||||||
# highlightbackground=element.BackgroundColor,
|
highlightbackground=element.BackgroundColor,
|
||||||
# highlightcolor=element.BackgroundColor)
|
highlightcolor=element.BackgroundColor)
|
||||||
# if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None:
|
if element.TextColor != COLOR_SYSTEM_DEFAULT and element.TextColor is not None:
|
||||||
# element.TKNotebook.configure(foreground=element.TextColor)
|
element.TKNotebook.configure(foreground=element.TextColor)
|
||||||
# if element.BorderWidth is not None:
|
if element.BorderWidth is not None:
|
||||||
# element.TKNotebook.configure(borderwidth=element.BorderWidth)
|
element.TKNotebook.configure(borderwidth=element.BorderWidth)
|
||||||
# if element.Tooltip is not None:
|
if element.Tooltip is not None:
|
||||||
# element.TooltipObject = ToolTip(element.TKNotebook, text=element.Tooltip,
|
element.TooltipObject = ToolTip(element.TKNotebook, text=element.Tooltip,
|
||||||
# timeout=DEFAULT_TOOLTIP_TIME)
|
timeout=DEFAULT_TOOLTIP_TIME)
|
||||||
# ------------------------- SLIDER Box element ------------------------- #
|
# ------------------------- SLIDER Box element ------------------------- #
|
||||||
elif element_type == ELEM_TYPE_INPUT_SLIDER:
|
elif element_type == ELEM_TYPE_INPUT_SLIDER:
|
||||||
slider_length = element_size[0] * CharWidthInPixels()
|
slider_length = element_size[0] * CharWidthInPixels()
|
||||||
|
|
Loading…
Reference in New Issue