Automatically color Tabs based on Look and Feel setting

This commit is contained in:
PySimpleGUI 2019-12-07 13:27:25 -05:00
parent 6a3e14e03c
commit 4d4237520e
1 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.8.0.5 Unreleased - Tab colors! No nag theme = DefaultNoMoreNagging" version = __version__ = "4.8.0.6 Unreleased - Tab colors! No nag theme = DefaultNoMoreNagging, auto-color tabs based on look and feel"
port = 'PySimpleGUI' port = 'PySimpleGUI'
@ -3754,9 +3754,10 @@ class TabGroup(Element):
self.ReturnValuesDictionary = {} self.ReturnValuesDictionary = {}
self.DictionaryKeyCounter = 0 self.DictionaryKeyCounter = 0
self.ParentWindow = None self.ParentWindow = None
self.SelectedTitleColor = selected_title_color self.SelectedTitleColor = selected_title_color if selected_title_color is not None else LOOK_AND_FEEL_TABLE[CURRENT_LOOK_AND_FEEL]['TEXT']
self.SelectedBackgroundColor = selected_background_color self.SelectedBackgroundColor = selected_background_color if selected_background_color is not None else LOOK_AND_FEEL_TABLE[CURRENT_LOOK_AND_FEEL]['BACKGROUND']
self.TabBackgroundColor = tab_background_color title_color = title_color if title_color is not None else LOOK_AND_FEEL_TABLE[CURRENT_LOOK_AND_FEEL]['TEXT_INPUT']
self.TabBackgroundColor = tab_background_color if tab_background_color is not None else LOOK_AND_FEEL_TABLE[CURRENT_LOOK_AND_FEEL]['INPUT']
self.Rows = [] self.Rows = []
self.TKNotebook = None # type: ttk.Notebook self.TKNotebook = None # type: ttk.Notebook
self.Widget = None # type: ttk.Notebook self.Widget = None # type: ttk.Notebook
@ -3767,6 +3768,7 @@ class TabGroup(Element):
self.TabLocation = tab_location self.TabLocation = tab_location
self.ElementJustification = 'left' self.ElementJustification = 'left'
self.Layout(layout) self.Layout(layout)
super().__init__(ELEM_TYPE_TAB_GROUP, background_color=background_color, text_color=title_color, font=font, super().__init__(ELEM_TYPE_TAB_GROUP, background_color=background_color, text_color=title_color, font=font,
@ -12369,7 +12371,7 @@ def main():
[Frame('Input Text Group', frame1, title_color='red'), [Frame('Input Text Group', frame1, title_color='red'),
Text('VERSION\n{}'.format(__version__), size=(25, 4), font='ANY 20'), Text('VERSION\n{}'.format(__version__), size=(25, 4), font='ANY 20'),
], ],
[TabGroup([[tab1, tab2, tab3, tab4]],key='_TAB_GROUP_', background_color='green',selected_title_color='red', title_color='blue' )], [TabGroup([[tab1, tab2, tab3, tab4]],key='_TAB_GROUP_', background_color='green')],
[Button('Button'), B('Hide Stuff', metadata='my metadata'), [Button('Button'), B('Hide Stuff', metadata='my metadata'),
Button('ttk Button', use_ttk_buttons=True, tooltip='This is a TTK Button'), Button('ttk Button', use_ttk_buttons=True, tooltip='This is a TTK Button'),
Button('See-through Mode', tooltip='Make the background transparent'), Button('See-through Mode', tooltip='Make the background transparent'),
@ -12386,6 +12388,7 @@ def main():
keep_on_top=True, keep_on_top=True,
element_justification='left', element_justification='left',
metadata='My window metadata', metadata='My window metadata',
# ttk_theme=THEME_VISTA,
# icon=PSG_DEBUGGER_LOGO # icon=PSG_DEBUGGER_LOGO
) )
# graph_elem.DrawCircle((200, 200), 50, 'blue') # graph_elem.DrawCircle((200, 200), 50, 'blue')