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

后端 未结 1 1063
深忆病人
深忆病人 2021-01-19 00:11

I\'m trying to change the alternating background color of a treeview. I know that this should normally be left up to the theme, but I\'d like to override to test the gtk Sty

相关标签:
1条回答
  • 2021-01-19 00:43

    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!

    0 讨论(0)
提交回复
热议问题