]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-13/list_list.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-13 / list_list.py
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_LIST mode",
8 size=(600,400))
9
10 # load some images into an image list
11 il = wx.ImageList(16,16, True)
12 for name in glob.glob("smicon??.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, style=wx.LC_LIST)
18
19 # assign the image list to it
20 self.list.AssignImageList(il, wx.IMAGE_LIST_SMALL)
21
22 # create some items for the list
23 for x in range(25):
24 img = x % (il_max+1)
25 self.list.InsertImageStringItem(x,
26 "This is item %02d" % x,
27 img)
28
29
30
31 app = wx.PySimpleApp()
32 frame = DemoFrame()
33 frame.Show()
34 app.MainLoop()