Changed combobox's selected background to gray50

This commit is contained in:
MikeTheWatchGuy 2018-12-13 14:32:20 -05:00
parent 51e616e004
commit ce77a48a02
1 changed files with 18 additions and 3 deletions

View File

@ -4501,11 +4501,25 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
element.TKStringVar = tk.StringVar() element.TKStringVar = tk.StringVar()
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT: if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
combostyle = ttk.Style() combostyle = ttk.Style()
#
# style.map("C.TButton",
# foreground=[('pressed', 'red'), ('active', 'blue')],
# background=[('pressed', '!disabled', 'black'), ('active', 'white')]
# )
# combostyle.map('PSG.TCombobox', background=[('selected', 'green')])
# combostyle.configure('PSG.TCombobox.Listbox',fieldbackground='green')
# combostyle.configure('PSG.TCombobox', foreground=text_color)
# combostyle.configure('PSG.TCombobox', selectbackground='gray70')
# combostyle.map('PSG.TCombobox', background=[('readonly','red')])
# combostyle.configure('PSG.TCombobox.TEntry', background='red')
# combostyle.configure('PSG.TCombobox', selectforeground=element.BackgroundColor)
# combostyle.configure('PSG.TCombobox', fieldbackground='blue')
try: try:
combostyle.theme_create('combostyle', combostyle.theme_create('combostyle',
settings={'TCombobox': settings={'TCombobox':
{'configure': {'configure':
{'selectbackground': element.BackgroundColor, {'selectbackground': 'gray50',
'fieldbackground': element.BackgroundColor, 'fieldbackground': element.BackgroundColor,
'foreground': text_color, 'foreground': text_color,
'background': element.BackgroundColor} 'background': element.BackgroundColor}
@ -4515,7 +4529,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
combostyle.theme_settings('combostyle', combostyle.theme_settings('combostyle',
settings={'TCombobox': settings={'TCombobox':
{'configure': {'configure':
{'selectbackground': element.BackgroundColor, {'selectbackground': 'gray50',
'fieldbackground': element.BackgroundColor, 'fieldbackground': element.BackgroundColor,
'foreground': text_color, 'foreground': text_color,
'background': element.BackgroundColor} 'background': element.BackgroundColor}
@ -4524,6 +4538,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
pass pass
# ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox # ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox
combostyle.theme_use('combostyle') combostyle.theme_use('combostyle')
element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar, font=font) element.TKCombo = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar, font=font)
if element.Size[1] != 1 and element.Size[1] is not None: if element.Size[1] != 1 and element.Size[1] is not None:
element.TKCombo.configure(height=element.Size[1]) element.TKCombo.configure(height=element.Size[1])
@ -6809,7 +6824,7 @@ def main():
Frame('Binary Choice Group', frame3, title_color='purple'), Frame('Binary Choice Group', frame3, title_color='purple'),
Frame('Variable Choice Group', frame4, title_color='blue')], Frame('Variable Choice Group', frame4, title_color='blue')],
[Frame('Structured Data Group', frame5, title_color='red'), ], [Frame('Structured Data Group', frame5, title_color='red'), ],
# [Frame('Graphing Group', frame6)], [Frame('Graphing Group', frame6)],
[TabGroup([[tab1, tab2]])], [TabGroup([[tab1, tab2]])],
[ProgressBar(max_value=800, size=(60, 25), key='+PROGRESS+'), Button('Button'), Button('Exit')], [ProgressBar(max_value=800, size=(60, 25), key='+PROGRESS+'), Button('Button'), Button('Exit')],
] ]