| 134 | class Choice(wx.Panel): |
| 135 | """ColorCtrl: deverid fron wx.coreTextCtrl""" |
| 136 | def __init__(self, parent, choices, tp, title, unit): |
| 137 | wx.Panel.__init__(self, parent) |
| 138 | self.tp, self.choices = tp, choices |
| 139 | sizer = wx.BoxSizer( wx.HORIZONTAL ) |
| 140 | self.prefix = lab_title = wx.StaticText( self, wx.ID_ANY, title, |
| 141 | wx.DefaultPosition, wx.DefaultSize) |
| 142 | |
| 143 | lab_title.Wrap( -1 ) |
| 144 | sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) |
| 145 | self.ctrl = wx.Choice( self, wx.ID_ANY, |
| 146 | wx.DefaultPosition, wx.DefaultSize, |
| 147 | [str(choice) for choice in choices], 0 ) |
| 148 | |
| 149 | self.ctrl.SetSelection(0) |
| 150 | sizer.Add( self.ctrl, 2, wx.ALL, 5 ) |
| 151 | self.postfix = lab_unit = wx.StaticText( self, wx.ID_ANY, unit, |
| 152 | wx.DefaultPosition, wx.DefaultSize) |
| 153 | lab_unit.Wrap( -1 ) |
| 154 | sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) |
| 155 | self.SetSizer(sizer) |
| 156 | self.ctrl.Bind( wx.EVT_CHOICE, self.on_choice) |
| 157 | |
| 158 | def Bind(self, z, f): |
| 159 | self.f = f |