[Tkinter] ttk-->treeview-->tag_configure() not work over Python3.6 - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] ttk-->treeview-->tag_configure() not work over Python3.6 (/thread-32053.html) Pages:
1
2
|
ttk-->treeview-->tag_configure() not work over Python3.6 - hqbfljx - Jan-18-2021 Hi everyone, I am new comer of this forum. I got a problem relate to the with the ttk treeview: ### With the Python 3.6.12 the ttk-->treeview-->tag_configure() work ok which it can change the background color expectedly. ### But with the Python3.7 or later, it not work with the same codes that work in Python3.6.12 What is the problem? who knows? RE: ttk-->treeview-->tag_configure() not work over Python3.6 - Larz60+ - Jan-18-2021 Please show a code example containing the problem. Point out the lines where colour attribute applied RE: ttk-->treeview-->tag_configure() not work over Python3.6 - hqbfljx - Jan-19-2021 @Larz60+ #1, The Codes: from tkinter import * from tkinter import ttk # create the app root = Tk() root.title("Treeview Test") # Create pane window panew = PanedWindow(root, bd=0, bg="#202322", sashwidth=2) panew.pack(fill=BOTH, expand=1) left_frame = Frame(root, bg="#383838") tree = ttk.Treeview(left_frame) tree["columns"] = ("first", "second") tree.column("first", anchor="center") tree.column("second") tree.heading("first", text="first column") tree.heading("second", text="second column") tree.insert("", 0, "dir1", text="directory 1", open=True) tree.insert("dir1", "end", "dir 1", text="file 1 1",values=("file 1 A", "file 1 B")) id = tree.insert("", "end", "dir2", text="directory 2", open=True) # set the tag for this item tree.insert("dir2", "end", text="dir 2", values=("file 2 A", "file 2 B"), tags=('ttk')) tree.insert(id, "end", text="dir 3", values=("val 1 ", "val 2")) tree.insert("", 0, text="first line", values=("first line 1", "first line 2")) # tag configuration tree.tag_configure("ttk", background='yellow',foreground="red") # Create scroller bar ysb = ttk.Scrollbar(left_frame, orient=VERTICAL, command=tree.yview) xsb = ttk.Scrollbar(left_frame, orient=HORIZONTAL, command=tree.xview) tree['yscroll'] = ysb.set tree['xscroll'] = xsb.set root.configure(background='black') tree.grid(in_=left_frame, row=0, column=0, sticky=NSEW) ysb.grid(in_=left_frame, row=0, column=1, sticky=NS) xsb.grid(in_=left_frame, row=1, column=0, sticky=EW) left_frame.rowconfigure(0, weight=1) left_frame.columnconfigure(0, weight=1) panew.add(left_frame) w = Text(panew) panew.add(w) ttk.Style().theme_use('clam') print(ttk.Style().theme_names()) root.mainloop()#2, result by "Python 3.6.12 :: Anaconda, Inc." I don't know how to upload the screenshot. But the result is the item with tag 'ttk' show what i expected #2, result by "Python 3.8.3 (anaconda)" The item with tag 'ttk' have no difference compare to other items. RE: ttk-->treeview-->tag_configure() not work over Python3.6 - Larz60+ - Jan-19-2021 I'm running 3.9.1 and this script functions as written on my system. (Linux mint 20) You should download a copy of John Shipman's tkinter reference manual here This version from 2013 is the latest, but tkinter has changed little since then. If you want to dig deeper (really not necessary but interesting), there's a three volume illustrated set TCP/IP illistrated (Addison-Wesley Professional Computing Series) that can be bought used on Amazon fairly inexpensively RE: ttk-->treeview-->tag_configure() not work over Python3.6 - deanhystad - Jan-19-2021 I am using Python 3.8.2 and I don't see any red or yellow when I click on items RE: ttk-->treeview-->tag_configure() not work over Python3.6 - hqbfljx - Jan-19-2021 (Jan-19-2021, 07:57 PM)deanhystad Wrote: I am using Python 3.8.2 and I don't see any red or yellow when I click on items Yes, so I said it doesn't work over python3.6. Actually for this example, it need not any click, when the window appear the "dir 2" should be red and yellow. And I think its the tkinter's problem instead of python itself. I don't know whether there guys still maintain the tkinker that integrated into the core of python. if there have, the better is to let them know the issue. Anyway, thanks a lot.https://python-forum.io/images/icons/thumbsup.png RE: ttk-->treeview-->tag_configure() not work over Python3.6 - Larz60+ - Jan-20-2021 Quote:Deanhystad wites: I'm using Linux Mint 20, and I see both red and yellow. Is this perhaps OS related? [attachment=1047] RE: ttk-->treeview-->tag_configure() not work over Python3.6 - deanhystad - Jan-20-2021 Windows 10 RE: ttk-->treeview-->tag_configure() not work over Python3.6 - hqbfljx - Jan-20-2021 (Jan-20-2021, 01:10 AM)Larz60+ Wrote:I use Windows 10 + anaconda.Quote:Deanhystad wites: But as I said previous that when use python3.6 is OK, just as what your screenshot shows. but while use python 3.7 or later version, the effects gone! RE: ttk-->treeview-->tag_configure() not work over Python3.6 - Larz60+ - Jan-20-2021 Sorry, failed to mention that I am running python 3.9.1 from python.org Quote:I use Windows 10 + anaconda. Perhaps you should notify https://anaconda.org/contact/report. |