]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/BitmapComboBox.py
moved vararg CRT functions wrappers to a new wxcrtvararg.h header
[wxWidgets.git] / wxPython / demo / BitmapComboBox.py
CommitLineData
f27895d2
RD
1
2import wx
3import wx.combo
4
5import images
6
7#----------------------------------------------------------------------
8
9class 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
36def runTest(frame, nb, log):
37 win = TestPanel(nb, log)
38 return win
39
40#----------------------------------------------------------------------
41
42
43
44overview = """<html><body>
45<h2><center>wx.combo.BitmapComboBox</center></h2>
46
47A combobox that displays a bitmap in front of the list items. It
48currently only allows using bitmaps of one size, and resizes itself so
49that a bitmap can be shown next to the text field.
50
51</body></html>
52"""
53
54
55
56if __name__ == '__main__':
57 import sys,os
58 import run
59 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
60