From 4d4b7b7b3b8394c5ca6da4ed316eb0ca9a7ca659 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 13 Jun 2019 15:06:15 -0400 Subject: [PATCH] New TabGroup Method - SelectTab --- PySimpleGUI.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 293d7ed1..1cba6b88 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -2577,7 +2577,8 @@ class TabGroup(Element): self.ParentWindow = None self.SelectedTitleColor = selected_title_color self.Rows = [] - self.TKNotebook = None + self.TKNotebook = None # type: ttk.Notebook + self.Widget = None # type: ttk.Notebook self.TabCount = 0 self.BorderWidth = border_width self.Theme = theme @@ -2623,6 +2624,12 @@ class TabGroup(Element): return element.Key return None + def SelectTab(self, index): + try: + self.TKNotebook.select(index) + except Exception as e: + print('Exception Selecting Tab {}'.format(e)) + def __del__(self): for row in self.Rows: for element in row: @@ -5950,7 +5957,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): element.TKFrame.bind('', element._RightClickMenuCallback) # ------------------------- TabGroup element ------------------------- # elif element_type == ELEM_TYPE_TAB_GROUP: - + element=element # type: TabGroup custom_style = str(element.Key) + 'customtab.TNotebook' style = ttk.Style(tk_row_frame) if element.Theme is not None: