]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/BitmapComboBox.py
   7 #---------------------------------------------------------------------- 
   9 class TestPanel(wx
.Panel
): 
  10     def __init__(self
, parent
, log
): 
  12         wx
.Panel
.__init
__(self
, parent
, -1) 
  14         bcb 
= wx
.combo
.BitmapComboBox(self
, pos
=(25,25), size
=(200,-1)) 
  17             funcName 
= 'getLB%02dImage' % (x
+1) 
  18             func 
= getattr(images
, funcName
) 
  21             bmp 
= img
.ConvertToBitmap() 
  22             bcb
.Append('images.%s()' % funcName
, bmp
, funcName
) 
  24         self
.Bind(wx
.EVT_COMBOBOX
, self
.OnCombo
, bcb
) 
  26     def OnCombo(self
, evt
): 
  27         bcb 
= evt
.GetEventObject() 
  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
)) 
  34 #---------------------------------------------------------------------- 
  36 def runTest(frame
, nb
, log
): 
  37     win 
= TestPanel(nb
, log
) 
  40 #---------------------------------------------------------------------- 
  44 overview 
= """<html><body> 
  45 <h2><center>wx.combo.BitmapComboBox</center></h2> 
  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. 
  56 if __name__ 
== '__main__': 
  59     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])