ttk treeview: alternate row colors

前端 未结 4 1193
野性不改
野性不改 2020-12-01 13:09

How can I set a style for treeview widgets so that alternate rows have different background colors, for example, rows 1,3,5 have white backgrounds and rows 2,4,

4条回答
  •  青春惊慌失措
    2020-12-01 13:26

    I realise this is an old question but just for the record configuring the tags just after creating the tree (i.e. when no items have yet been added to it) also works. As items get inserted later on they will be given the background colour appropriate to their 'oddrow' or 'evenrow' tag.

提交回复
热议问题