[issue36468] Treeview: wrong color change
Matthew Barnett
report at bugs.python.org
Thu May 16 19:20:50 EDT 2019
Matthew Barnett <python at mrabarnett.plus.com> added the comment:
I've just come across the same problem.
For future reference, adding the following code before using a Treeview widget will fix the problem:
def fixed_map(option):
# Fix for setting text colour for Tkinter 8.6.9
# From: https://core.tcl.tk/tk/info/509cafafae
#
# Returns the style map for 'option' with any styles starting with
# ('!disabled', '!selected', ...) filtered out.
# style.map() returns an empty list for missing options, so this
# should be future-safe.
return [elm for elm in style.map('Treeview', query_opt=option) if
elm[:2] != ('!disabled', '!selected')]
style = ttk.Style()
style.map('Treeview', foreground=fixed_map('foreground'),
background=fixed_map('background'))
----------
nosy: +mrabarnett
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36468>
_______________________________________
More information about the Python-bugs-list
mailing list