wxpython怎么开发树型控件的复选框
1个回答
展开全部
用wx.lib.agw.customtreectrl,下面的代码没有添加事件,具体可参阅文档。
01.#coding=utf-8
02.import wx
03.import wx.lib.agw.customtreectrl as CT
04.
05.class MyFrame(wx.Frame):
06. def __init__(self, parent):
07. wx.Frame.__init__(self, parent, -1, "CustomTreeCtrl")
08. self.custom_tree = CT.CustomTreeCtrl(self, agwStyle=wx.TR_DEFAULT_STYLE)
09. root = self.custom_tree.AddRoot(u"根选项")
10.
11. for y in range(5):
12. item = self.custom_tree.AppendItem(root, u"选项%d" % y, ct_type=1)
13.
14.app = wx.PySimpleApp()
15.frame = MyFrame(None)
16.app.SetTopWindow(frame)
17.frame.Show()
18.app.MainLoop()
01.#coding=utf-8
02.import wx
03.import wx.lib.agw.customtreectrl as CT
04.
05.class MyFrame(wx.Frame):
06. def __init__(self, parent):
07. wx.Frame.__init__(self, parent, -1, "CustomTreeCtrl")
08. self.custom_tree = CT.CustomTreeCtrl(self, agwStyle=wx.TR_DEFAULT_STYLE)
09. root = self.custom_tree.AddRoot(u"根选项")
10.
11. for y in range(5):
12. item = self.custom_tree.AppendItem(root, u"选项%d" % y, ct_type=1)
13.
14.app = wx.PySimpleApp()
15.frame = MyFrame(None)
16.app.SetTopWindow(frame)
17.frame.Show()
18.app.MainLoop()
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询