how to create striped treeview in tkinter

Solutions on MaxInterview for how to create striped treeview in tkinter by the best coders in the world

showing results for - "how to create striped treeview in tkinter"
Ramsey
11 Jan 2017
1data=[
2    ['Mary',1,"Pepperoni"],
3    ["Elan",2,"Mushroom"]
4]
5
6#Create striped row tags
7my_tree.tag_configure('oddrow',background='white')
8my_tree.tag_configure('evenrow',background='lightblue')
9
10
11for index,record in enumerate(data):
12    if index%2==0:
13        my_tree.insert(parent='',index='end',iid=index,text="",values=(record[0],record[1],record[2]),tags='evenrow')
14    else:
15        my_tree.insert(parent='',index='end',iid=index,text="",values=(record[0],record[1],record[2]),tags='oddrow')