]>
Commit | Line | Data |
---|---|---|
be05b434 RD |
1 | import wx |
2 | import sys, glob | |
3 | ||
4 | class DemoFrame(wx.Frame): | |
5 | def __init__(self): | |
6 | wx.Frame.__init__(self, None, -1, | |
7 | "wx.ListCtrl in wx.LC_ICON mode", | |
8 | size=(600,400)) | |
9 | ||
10 | # load some images into an image list | |
11 | il = wx.ImageList(32,32, True) | |
12 | for name in glob.glob("icon??.png"): | |
13 | bmp = wx.Bitmap(name, wx.BITMAP_TYPE_PNG) | |
14 | il_max = il.Add(bmp) | |
15 | ||
16 | # create the list control | |
17 | self.list = wx.ListCtrl(self, -1, | |
18 | style=wx.LC_ICON | wx.LC_AUTOARRANGE) | |
19 | ||
20 | # assign the image list to it | |
21 | self.list.AssignImageList(il, wx.IMAGE_LIST_NORMAL) | |
22 | ||
23 | # create some items for the list | |
24 | for x in range(25): | |
25 | img = x % (il_max+1) | |
26 | self.list.InsertImageStringItem(x, | |
27 | "This is item %02d" % x, img) | |
28 | ||
29 | app = wx.PySimpleApp() | |
30 | frame = DemoFrame() | |
31 | frame.Show() | |
32 | app.MainLoop() |