- 论坛徽章:
- 3
|
本帖最后由 sunny7476 于 2013-06-27 22:19 编辑
用wx.lib.agw.customtreectrl,下面的代码没有添加事件,具体可参阅文档。- #coding=utf-8
- import wx
- import wx.lib.agw.customtreectrl as CT
- class MyFrame(wx.Frame):
- def __init__(self, parent):
- wx.Frame.__init__(self, parent, -1, "CustomTreeCtrl")
- self.custom_tree = CT.CustomTreeCtrl(self, agwStyle=wx.TR_DEFAULT_STYLE)
- root = self.custom_tree.AddRoot(u"根选项")
-
- for y in range(5):
- item = self.custom_tree.AppendItem(root, u"选项%d" % y, ct_type=1)
- app = wx.PySimpleApp()
- frame = MyFrame(None)
- app.SetTopWindow(frame)
- frame.Show()
- app.MainLoop()
复制代码 |
|