]> git.saurik.com Git - wxWidgets.git/blame - wxPython/samples/wxPIA_book/Chapter-13/list_smicon.py
fixed deadlock when calling wxPostEvent() from worker thread
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-13 / list_smicon.py
CommitLineData
be05b434
RD
1import wx
2import sys, glob
3
4class DemoFrame(wx.Frame):
5 def __init__(self):
6 wx.Frame.__init__(self, None, -1,
7 "wx.ListCtrl in wx.LC_SMALL_ICON 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,
18 style=wx.LC_SMALL_ICON
19 | wx.LC_AUTOARRANGE
20 )
21
22 # assign the image list to it
23 self.list.AssignImageList(il, wx.IMAGE_LIST_SMALL)
24
25 # create some items for the list
26 for x in range(25):
27 img = x % (il_max+1)
28 self.list.InsertImageStringItem(x,
29 "This is item %02d" % x,
30 img)
31
32app = wx.PySimpleApp()
33frame = DemoFrame()
34frame.Show()
35app.MainLoop()