Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-13 Thread stefalem
Il 12/02/23 12:10, John O'Hagan ha scritto: > My goal was to be able to change the colour of an individual item > regardless of whether it is selected or not. To do that, it is > necessary to be able to change the colour of an individual selected > item, without changing the selection or

Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-12 Thread John O'Hagan
On Sun, 2023-02-12 at 08:59 -0500, Thomas Passin wrote: [...] > On 2/12/2023 6:10 AM, John O'Hagan wrote: [...] > > > > My goal was to be able to change the colour of an individual item > > regardless of whether it is selected or not. To do that, it is > > necessary to be able to change the

Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-12 Thread Thomas Passin
On 2/12/2023 6:10 AM, John O'Hagan wrote: On Mon, 2023-02-06 at 10:19 -0800, stefalem wrote: Il giorno sabato 4 febbraio 2023 alle 11:43:29 UTC+1 John O'Hagan ha scritto: ... Is there another way to do what I want? from tkinter import * from tkinter.ttk import * root = Tk() t =

Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-12 Thread John O'Hagan
On Mon, 2023-02-06 at 10:19 -0800, stefalem wrote: > Il giorno sabato 4 febbraio 2023 alle 11:43:29 UTC+1 John O'Hagan ha > scritto: > ... > > > Is there another way to do what I want?  > > from tkinter import * > from tkinter.ttk import * > > root = Tk() > t = Treeview(root) > > t.insert('',

Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-06 Thread stefalem
I apologize for the 3 messages sent, I could not access the usual news server and with Google Groups I messed up :) -- https://mail.python.org/mailman/listinfo/python-list

Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-06 Thread stefalem
> Is there another way to do what I want? try this: from tkinter import * from tkinter.ttk import * root = Tk() t = Treeview(root) t.insert('', 0, iid='item1', text='item1') t.insert('', 1, text='item2') t.tag_configure('flashtag', background='red') t.pack() def flash(): tags =

Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-06 Thread stefalem
Il giorno sabato 4 febbraio 2023 alle 11:43:29 UTC+1 John O'Hagan ha scritto: ... > Is there another way to do what I want? from tkinter import * from tkinter.ttk import * root = Tk() t = Treeview(root) t.insert('', 0, iid='item1', text='item1') t.insert('', 1, text='item2')

Re: tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-04 Thread Thomas Passin
I haven't worked specifically with a Treeview, but I think you need to detect the onClick event (or an onSelect event if there is one) and have that trigger the flashing. Otherwise the selection probably overwrites styling that you added. That's what I do for classic Tk buttons to make them

tkinter ttk.Treeview: changing background colour of single item when selected

2023-02-04 Thread John O'Hagan
Hi list I'm using a ttk Treeview to display a hierarchical data structure. When an error condition arises in a node, I want the corresponding item in the Treeview to flash its background color.  Using a tag to flash the item background works, except when the item is selected, when the tag has no