How do you change alternating background row colors of a gtk.TreeView in pygtk?

醉酒当歌 提交于 2019-12-01 18:33:22

I finally figured out my issue with this styling method. The 'allow-rules' style property isn't the only property that tells the treeview to color the rows in alternating colors. According to the documentation, the treeview has another property that hints to the engine that it should draw rows in alternating colors. The 'rules-hint' property, False by default, when True successfully colors my TreeView in alternating odd/even row colors!

So, in code, add this line to the code in the question:

treeview.set_rules_hint( True )

And that's it, a TreeView with alternating colored rows!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!