Re: ttk.Treeview: coloring rows using tags doesn't work with Python 3.7.3
Sibylle Koczian <[email protected]> Tue, 30 Apr 2019 15:43:54 +0200
| Newsgroups | gmane.comp.python.tkinter |
|---|---|
| Message-ID | <[email protected]> |
Am 29.04.2019 um 22:51 schrieb Michael Lange: > Hi, > > On Mon, 29 Apr 2019 13:16:50 +0200 > Sibylle Koczian <[email protected]> wrote: > >> Hello, >> >> the following script shows a Treeview with names and country codes of >> some towns in Germany. Towns with country code "HE" or "BY" should be >> shown with coloured background, in the case of "BY" additionally with >> white text. >> >> This works using Python 3.5 or 3.6. I seem to remember that it worked >> with earlier versions of Python 3.7, but that's not certain. Using >> Python 3.7.3 all the entries have white background and black text. >> Opening an entry with Enter or double click shows the name of the town >> in the Entry field, together with the country name, if the row has the >> tag for HE or BY. So the entries have the tags they should, but the >> color doesn't change. >> >> Changing the font of an entry using tags does work. >> >> All of these Python versions come with tcl/tk version 8.6, but I don't >> know the patch numbers, they probably changed. The official >> documentation for tkinter and for tcl/tk seems to show that the script >> is correct. I can see no hint of recent changes in the use of tags, >> tag_configure and the options usable with tags. > > just a shot into the dark: > > maybe the problem is not at all how the treeview handles tags, but how Tk > handles named colors? Did you try to use hex color specs like '#d9d9d9' > instead of 'darkgray' or 'lightgreen'? According to > https://www.tcl-lang.org/man/tcl8.6/TkCmd/colors.htm > there should be "dark gray" and "LightGreen", but maybe your version of > Tk somehow fails to treat the color names case-insensitive resp. > "space-insensitive". > That would be very nice. But no, I just forgot to mention it: I tried with hex color specs and I tried with the most simple color names: just "green" (and "white" for the foreground color of bavarian towns). Nothing. BTW I used Python 3.7.3 with Windows 10 and with ArchLinux, LXQt as desktop, everything freshly updated. Thank you, Sibylle