'How can i change the color background to row in treeview ( python tkinter)
i building with tkinter a tree view that display me a lot of data and i want when in column 5 there is the word "free" the color background of the row will be yellow how can i do that? ty for your help
def Read():
    Database()
    cursor.execute("SELECT * FROM `tbl_Employees")
    fetch = cursor.fetchall()
    for data in fetch:
        tree.insert('', 'end', values=(data[1], data[2], data[3], data[4], data[5], data[6]))
    cursor.close()
    conn.close()
    txt_result.config(text="Successfully read the data from database", fg="green")
    txt_result.after(2000, clear_txt)
i tried to insert
if data[5] == 'free':
   ....??
but i dont know what the right command in the if block that going to do what i want
Solution 1:[1]
 def Read():
    Database()
    cursor.execute("SELECT * FROM `tbl_Employees")
    fetch = cursor.fetchall()
    for data in fetch:
        tree.insert('', 'end', values=(data[1], data[2], data[3], data[4], data[5],))
    cursor.close()
    conn.close()
    txt_result.config(text="Successfully read the data from database", fg="green")
    txt_result.after(2000, clear_txt)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Bryan Oakley | 
