import
wx
class
MainFrame(wx.Frame):
def
__init__(
self
):
wx.Frame.__init__(
self
, parent
=
None
, title
=
'TreeCtrl Demo'
)
self
.tree
=
wx.TreeCtrl(
self
, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize)
il
=
wx.ImageList(
16
,
16
)
one
=
il.Add(wx.Image(
'plus.png'
, wx.BITMAP_TYPE_PNG).Scale(
16
,
16
).ConvertToBitmap())
two
=
il.Add(wx.Image(
'close.png'
).Scale(
16
,
16
).ConvertToBitmap())
self
.tree.AssignImageList(il)
self
.root
=
self
.tree.AddRoot(
'Root '
,
0
)
self
.tree.AppendItem(
self
.root,
"Item"
,
1
)
self
.tree.Expand(
self
.root)
self
.Show()
if
__name__
=
=
'__main__'
:
app
=
wx.App(redirect
=
False
)
frame
=
MainFrame()
app.MainLoop()