Il giorno 18 ottobre 2018 10:36, Marco De Paoli <depao...@gmail.com> ha scritto:
in pratica prima devi fare un tag_configure per definire il tag che ti > servono > e poi assegni il tag (o i tag) che vuoi ai vari item > > elenco.tag_configure("warning", background='red') > elenco.tag_configure("normal", background='black') > Lo avevo fatto, ma avevo interpretato male il manuale, al posto di NomeTag mettevo background :) Si così funziona, GRAZIE 1000. Posto il codice completo, magari potrebbe servire a qualcuno. Ciao Marcello from tkinter import ttk import tkinter as tk def selectItem(a): curItem = elenco.focus() print (elenco.item(curItem)["text"]) finestra = tk.Tk() elenco = ttk.Treeview(finestra, selectmode='browse') elenco.pack(side='left') vsb = ttk.Scrollbar(finestra, orient="vertical", command=elenco.yview) vsb.pack(side='right', fill='y') elenco.configure(yscrollcommand=vsb.set) elenco["columns"]=("one") elenco.column("one", width=100 ) elenco.insert("" , 0, text="Cliente ", values=("Raggiungibile")) elenco.tag_configure("normal", background='red') elenco.tag_configure("warning", background='yellow') for a in range (1,10): iid = elenco.insert("", a, a, text="aaaaaa") elenco.item(iid, tags=("warning", )) for b in range (10,20): iid = elenco.insert("", b, b, text="bbbbbb") elenco.item(iid, tags=("normal", )) elenco.bind('<ButtonRelease-1>', selectItem) elenco.pack() finestra.mainloop()
_______________________________________________ Python mailing list Python@lists.python.it https://lists.python.it/mailman/listinfo/python