Hierarchical checked tree control with tri-state checkboxes in wxPython?
As per the title, is this possible?
By tri-state, I mean the parent node i开发者_JAVA百科s:
- Checked if all children are checked
- Unchecked if all children are unchecked
- Grey/Filled if some children are checked
I have used them previously in C# but cannot find an equivalent control/implementation for wxPython.
I was trying to do the same thing with the CustomTreeCtrl
and it does support tri-state check boxes.
When you create the root,
self.root= self.tree.AddRoot("root node",ct_type=1)
or a child node,
child= self.tree.AppendItem(parent,"child",ct_type=1)
it returns a GenericTreeItem
object which you can change the attribute _is3State
to True with,
self.root.Set3State(True)
or
child.Set3State(True)
Did you look at wx.lib.agw.CustomTreeCtrl?
I'm not sure it does tri-state out of the box, but it's written in Python, so it should be quite easy to extend it.
精彩评论