]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/BitmapComboBox.py
Have SetSizerProps internally handle the assignment of growable rows and cols.
[wxWidgets.git] / wxPython / demo / BitmapComboBox.py
1
2 import wx
3 import wx.combo
4
5 import images
6
7 #----------------------------------------------------------------------
8
9 class TestPanel(wx.Panel):
10 def __init__(self, parent, log):
11 self.log = log
12 wx.Panel.__init__(self, parent, -1)
13
14 bcb = wx.combo.BitmapComboBox(self, pos=(25,25), size=(200,-1))
15
16 for x in range(12):
17 funcName = 'getLB%02dImage' % (x+1)
18 func = getattr(images, funcName)
19 img = func()
20 img.Rescale(20,20)
21 bmp = img.ConvertToBitmap()
22 bcb.Append('images.%s()' % funcName, bmp, funcName)
23
24 self.Bind(wx.EVT_COMBOBOX, self.OnCombo, bcb)
25
26 def OnCombo(self, evt):
27 bcb = evt.GetEventObject()
28 idx = evt.GetInt()
29 st = bcb.GetString(idx)
30 cd = bcb.GetClientData(idx)
31 self.log.write("EVT_COMBOBOX: Id %d, string '%s', clientData '%s'" % (idx, st, cd))
32
33
34 #----------------------------------------------------------------------
35
36 def runTest(frame, nb, log):
37 win = TestPanel(nb, log)
38 return win
39
40 #----------------------------------------------------------------------
41
42
43
44 overview = """<html><body>
45 <h2><center>wx.combo.BitmapComboBox</center></h2>
46
47 A combobox that displays a bitmap in front of the list items. It
48 currently only allows using bitmaps of one size, and resizes itself so
49 that a bitmap can be shown next to the text field.
50
51 </body></html>
52 """
53
54
55
56 if __name__ == '__main__':
57 import sys,os
58 import run
59 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
60