开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜