Python wx.Choice() Examples
The following are 30
code examples of wx.Choice().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: bug166.py From wxGlade with MIT License | 6 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetTitle("frame_1") sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_1.Add(sizer_2, 1, 0, 0) self.choice_1 = wx.Choice(self, wx.ID_ANY, choices=["Pure ASCII", u"German Umlauts äöüÄÖÜß"]) self.choice_1.SetSelection(1) sizer_2.Add(self.choice_1, 1, wx.ALL | wx.EXPAND, 5) self.label_1 = wx.StaticText(self, wx.ID_ANY, u"German Umlauts äöüÄÖÜß", style=wx.ALIGN_CENTER) sizer_2.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer_1) sizer_1.Fit(self) self.Layout() # end wxGlade # end of class MyFrame
Example #2
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def Configure(self, osd="", dur=3, pos=1): panel = eg.ConfigPanel() osdLabel = wx.StaticText(panel,-1,self.text.osdLabel) posLabel = wx.StaticText(panel,-1,self.text.posLabel) durLabel = wx.StaticText(panel,-1,self.text.durLabel) osdCtrl = wx.TextCtrl(panel,-1,osd, size=(200,-1)) durCtrl = eg.SpinIntCtrl(panel, -1, dur, max=99999) posCtrl = wx.Choice(panel,-1,choices=self.text.position) posCtrl.SetSelection(pos) sizer = wx.FlexGridSizer(3, 2, 5, 10) sizer.Add(osdLabel,0,wx.TOP,3) sizer.Add(osdCtrl) sizer.Add(durLabel,0,wx.TOP,3) sizer.Add(durCtrl) sizer.Add(posLabel,0,wx.TOP,3) sizer.Add(posCtrl) panel.sizer.Add(sizer,0,wx.ALL|wx.EXPAND,20) while panel.Affirmed(): panel.SetResult( osdCtrl.GetValue(), durCtrl.GetValue(), posCtrl.GetSelection(), ) #===============================================================================
Example #3
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def Configure(self, imageFileName='', style=1): panel = eg.ConfigPanel() text = self.text filepathCtrl = eg.FileBrowseButton( panel, size = (340, -1), initialValue = imageFileName, labelText = "", fileMask = text.fileMask, buttonText = eg.text.General.browse, ) choice = wx.Choice(panel, -1, choices=text.choices) choice.SetSelection(style) sizer = panel.sizer sizer.Add(panel.StaticText(text.text1), 0, wx.EXPAND) sizer.Add(filepathCtrl, 0, wx.EXPAND) sizer.Add(panel.StaticText(text.text2), 0, wx.EXPAND | wx.TOP, 10) sizer.Add(choice, 0, wx.BOTTOM, 10) while panel.Affirmed(): panel.SetResult(filepathCtrl.GetValue(), choice.GetSelection())
Example #4
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def Configure(self, value=0, deviceId=0): deviceId = SoundMixer.GetDeviceId(deviceId) panel = eg.ConfigPanel() deviceCtrl = panel.Choice( deviceId + 1, choices=SoundMixer.GetMixerDevices(True) ) #if eg.WindowsVersion >= 'Vista': # deviceCtrl.SetValue(0) # deviceCtrl.Enable(False) valueCtrl = panel.SmartSpinNumCtrl(value, min=-100, max=100) sizer = eg.HBoxSizer( (panel.StaticText(self.text.text1), 0, wx.ALIGN_CENTER_VERTICAL), (valueCtrl, 0, wx.LEFT | wx.RIGHT, 5), (panel.StaticText(self.text.text2), 0, wx.ALIGN_CENTER_VERTICAL), ) #panel.AddLine("Device:", deviceCtrl) panel.AddLine(self.plugin.text.device, deviceCtrl) panel.AddLine(sizer) while panel.Affirmed(): panel.SetResult( valueCtrl.GetValue(), deviceCtrl.GetStringSelection(), )
Example #5
Source File: Input_Dialog_OLD1.py From topoflow with MIT License | 6 votes |
def row_box(self, row): label = wx.TextCtrl(self.panel, -1, value=self.var_names[row]) model_input_types = ["Scalar", "Time series", "Grid", "Grid sequence"] dlist = wx.Choice(self.panel, -1, choices=model_input_types) # Set to current input type here text = wx.TextCtrl(self.panel, -1, self.var_setting[row]) ustr = wx.StaticText(self.panel, -1, self.var_units[row]) # self.Bind(wx.EVT_CHOICE, self.onChoice, self.var_type) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(label, 0, wx.GROW, border=self.pad) box.Add(dlist, 0, wx.GROW, border=self.pad) box.Add(text, 0, wx.GROW, border=self.pad) box.Add(ustr, 0, wx.GROW, border=self.pad) # box.AddMany([label, dlist, text, ustr]) #, 1, wx.EXPAND) # self.SetSizer(box) return box #--------------------------------------------- # Create sizer box for the process timestep #---------------------------------------------
Example #6
Source File: Input_Dialog_OLD2.py From topoflow with MIT License | 6 votes |
def row_box(self, row): label = wx.TextCtrl(self.panel, -1, value=self.var_names[row]) model_input_types = ["Scalar", "Time series", "Grid", "Grid sequence"] dlist = wx.Choice(self.panel, -1, choices=model_input_types) # Set to current input type here text = wx.TextCtrl(self.panel, -1, self.var_setting[row]) ustr = wx.StaticText(self.panel, -1, self.var_units[row]) # self.Bind(wx.EVT_CHOICE, self.onChoice, self.var_type) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(label, 0, wx.GROW, border=self.pad) box.Add(dlist, 0, wx.GROW, border=self.pad) box.Add(text, 0, wx.GROW, border=self.pad) box.Add(ustr, 0, wx.GROW, border=self.pad) # box.AddMany([label, dlist, text, ustr]) #, 1, wx.EXPAND) # self.SetSizer(box) return box #--------------------------------------------- # Create sizer box for the process timestep #---------------------------------------------
Example #7
Source File: font_dialog.py From wxGlade with MIT License | 6 votes |
def __init__(self, *args, **kwds): kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.label_2_copy = wx.StaticText(self, -1, _("Family:")) self.label_3_copy = wx.StaticText(self, -1, _("Style:")) self.label_4_copy = wx.StaticText(self, -1, _("Weight:")) self.family = wx.Choice(self, -1, choices=["Default", "Decorative", "Roman", "Script", "Swiss", "Modern"]) self.style = wx.Choice(self, -1, choices=["Normal", "Slant", "Italic"]) self.weight = wx.Choice(self, -1, choices=["Normal", "Light", "Bold"]) self.label_1 = wx.StaticText(self, -1, _("Size in points:")) self.point_size = wx.SpinCtrl(self, -1, "", min=0, max=100) self.underline = wx.CheckBox(self, -1, _("Underlined")) self.font_btn = wx.Button(self, -1, _("Specific font...")) self.static_line_1 = wx.StaticLine(self, -1) self.ok_btn = wx.Button(self, wx.ID_OK, _("OK")) self.cancel_btn = wx.Button(self, wx.ID_CANCEL, _("Cancel")) self.__set_properties() self.__do_layout() self.value = None self.font_btn.Bind(wx.EVT_BUTTON, self.choose_specific_font) self.ok_btn.Bind(wx.EVT_BUTTON, self.on_ok)
Example #8
Source File: ChangeDisplaySettings.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def GetValue(self): pos = wx.Choice.GetSelection(self) return self.displays[pos]
Example #9
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, index = 0): panel = eg.ConfigPanel() mySizer = panel.sizer staticText = panel.StaticText(self.text.label) choiceCtrl=wx.Choice( panel, choices=self.text.choices, ) choiceCtrl.SetSelection(index) mySizer.Add(staticText, 0, wx.TOP, 15) mySizer.Add(choiceCtrl, 0, wx.TOP, 2) while panel.Affirmed(): panel.SetResult(choiceCtrl.GetSelection())
Example #10
Source File: ChangeDisplaySettings.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, id=-1, display=0): self.displays = GetDisplays() wx.Choice.__init__(self, parent, id) for i, display in enumerate(self.displays): self.Append("%d: %s" % (i + 1, display.deviceString)) self.SetClientData(i, display.deviceName) self.SetSelection(0)
Example #11
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, action = -1): panel = eg.ConfigPanel() label = wx.StaticText(panel, -1, self.text.label) ctrl = wx.Choice(panel, -1, choices = self.text.choices) eg.EqualizeWidths((label, ctrl)) ctrl.SetSelection(action) panel.sizer.Add(label, 0, wx.TOP, 20) panel.sizer.Add(ctrl, 0, wx.TOP, 3) while panel.Affirmed(): panel.SetResult(ctrl.GetSelection()) #===============================================================================
Example #12
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, index = 0): panel = eg.ConfigPanel() mySizer = panel.sizer staticText = panel.StaticText(self.text.label) choices = GetChoices() choiceCtrl=wx.Choice( panel, choices=[item[0] for item in choices], ) choiceCtrl.SetSelection(index) mySizer.Add(staticText, 0, wx.TOP, 15) mySizer.Add(choiceCtrl, 0, wx.TOP, 2) while panel.Affirmed(): panel.SetResult(choiceCtrl.GetSelection())
Example #13
Source File: UriEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def _init_ctrls(self, parent): self.UriTypeChoice = wx.Choice(parent=self, choices=self.choices) self.UriTypeChoice.SetSelection(0) self.Bind(wx.EVT_CHOICE, self.OnTypeChoice, self.UriTypeChoice) self.editor_sizer = wx.BoxSizer(wx.HORIZONTAL) self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
Example #14
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, deviceId=0): deviceId = SoundMixer.GetDeviceId(deviceId) panel = eg.ConfigPanel() deviceCtrl = panel.Choice( deviceId + 1, choices=SoundMixer.GetMixerDevices(True) ) """if eg.WindowsVersion >= 'Vista': deviceCtrl.SetValue(0) deviceCtrl.Enable(False)""" #panel.AddLine("Device:", deviceCtrl) panel.AddLine(self.plugin.text.device, deviceCtrl) while panel.Affirmed(): panel.SetResult(deviceCtrl.GetStringSelection())
Example #15
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, value=0, deviceId=0): deviceId = SoundMixer.GetDeviceId(deviceId) panel = eg.ConfigPanel() deviceCtrl = panel.Choice( deviceId + 1, choices=SoundMixer.GetMixerDevices(True) ) # deviceCtrl = panel.Choice(deviceId, SoundMixer.GetMixerDevices()) """if eg.WindowsVersion >= 'Vista': deviceCtrl.SetValue(0) deviceCtrl.Enable(False)""" valueCtrl = panel.SmartSpinNumCtrl(value, min=0, max=100) label1 = panel.StaticText(self.text.text1) label3 = panel.StaticText(self.plugin.text.device) eg.EqualizeWidths((label1, label3)) sizer1 = eg.HBoxSizer( (label3, 0, wx.ALIGN_CENTER_VERTICAL), (deviceCtrl, 1, wx.LEFT | wx.RIGHT, 5), ) style1 = wx.LEFT | wx.RIGHT style2 = wx.TOP if isinstance(valueCtrl.ctrl, wx._controls.TextCtrl): style1 |= wx.EXPAND style2 |= wx.EXPAND sizer2 = eg.HBoxSizer( (label1, 0, wx.ALIGN_CENTER_VERTICAL), (valueCtrl, 1, style1, 5), (panel.StaticText(self.text.text2), 0, wx.ALIGN_CENTER_VERTICAL), ) panel.sizer.Add(sizer1, 0, wx.TOP, 10) panel.sizer.Add(sizer2, 0, style2, 10) while panel.Affirmed(): panel.SetResult( valueCtrl.GetValue(), deviceCtrl.GetStringSelection(), )
Example #16
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, deviceId=0): deviceId = SoundMixer.GetDeviceId(deviceId) panel = eg.ConfigPanel() deviceCtrl = panel.Choice( deviceId + 1, choices=SoundMixer.GetMixerDevices(True) ) """if eg.WindowsVersion >= 'Vista': deviceCtrl.SetValue(0) deviceCtrl.Enable(False)""" #panel.AddLine("Device:", deviceCtrl) panel.AddLine(self.plugin.text.device, deviceCtrl) while panel.Affirmed(): panel.SetResult(deviceCtrl.GetStringSelection())
Example #17
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, deviceId=0): deviceId = SoundMixer.GetDeviceId(deviceId) panel = eg.ConfigPanel() deviceCtrl = panel.Choice( deviceId + 1, choices=SoundMixer.GetMixerDevices(True) ) """if eg.WindowsVersion >= 'Vista': deviceCtrl.SetValue(0) deviceCtrl.Enable(False)""" #panel.AddLine("Device:", deviceCtrl) panel.AddLine(self.plugin.text.device, deviceCtrl) while panel.Affirmed(): panel.SetResult(deviceCtrl.GetStringSelection())
Example #18
Source File: CellEditor.py From bookhub with MIT License | 5 votes |
def __init__(self, *args, **kwargs): kwargs["choices"] = ["True", "False"] wx.Choice.__init__(self, *args, **kwargs)
Example #19
Source File: rstbx_frame.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwds): super(ZoomFrame, self).__init__(*args, **kwds) self.settings = self.GetParent().settings self.control_panel = wx.Panel(self) self.panel = rstbx.viewer.display.ZoomView(self, -1) szr = wx.BoxSizer(wx.VERTICAL) self.SetSizer(szr) szr.Add(self.control_panel) szr.Add(self.panel, 1, wx.EXPAND) self.numbers_box = wx.CheckBox(self.control_panel, -1, "Show intensity values") txt1 = wx.StaticText(self.control_panel, -1, "Text color:") self.text_color = wx.lib.colourselect.ColourSelect( self.control_panel, colour=(255, 255, 0) ) pszr = wx.BoxSizer(wx.VERTICAL) self.control_panel.SetSizer(pszr) box1 = wx.BoxSizer(wx.HORIZONTAL) pszr.Add(box1) box1.Add(self.numbers_box, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) box1.Add(txt1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) box1.Add(self.text_color, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) box2 = wx.BoxSizer(wx.HORIZONTAL) pszr.Add(box2) txt2 = wx.StaticText(self.control_panel, -1, "Magnification:") self.mag_ctrl = wx.Choice( self.control_panel, -1, choices=["%dx" % x for x in mag_levels] ) self.mag_ctrl.SetSelection(1) box2.Add(txt2, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) box2.Add(self.mag_ctrl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.Bind(wx.EVT_CLOSE, lambda evt: self.Destroy(), self) self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy) self.Bind(wx.EVT_CHECKBOX, self.OnChangeSettings, self.numbers_box) self.Bind( wx.lib.colourselect.EVT_COLOURSELECT, self.OnChangeSettings, self.text_color ) self.Bind(wx.EVT_CHOICE, self.OnChangeSettings, self.mag_ctrl) szr.Fit(self.panel) self.Fit()
Example #20
Source File: viewer_tools.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, images, loader): """ Create the fake wx.Choice object. :param images: The list-like object containing the image data :param loader: A function to call to load a specific entry as current """ super(LegacyChooserAdapter, self).__init__() self._images = images self._loader = loader
Example #21
Source File: configuration_dialogs.py From superpaper with MIT License | 5 votes |
def display_opt_widget_row(self, row_id): """Return a display option widget row.""" statbox_disp_opts = self.sizer_disp_opts.GetStaticBox() row_id = wx.StaticText(statbox_disp_opts, -1, str(row_id)) row_sax = wx.Choice(statbox_disp_opts, -1, name="SwivelAxisChoice", size=(self.tc_width*0.7, -1), choices=["No swivel", "Left", "Right"]) row_san = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1), style=wx.TE_RIGHT) row_sol = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1), style=wx.TE_RIGHT) row_sod = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1), style=wx.TE_RIGHT) row_tan = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1), style=wx.TE_RIGHT) row_tov = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1), style=wx.TE_RIGHT) row_tod = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1), style=wx.TE_RIGHT) # Prefill neutral data row_sax.SetSelection(0) row_san.SetValue("0") row_sol.SetValue("0") row_sod.SetValue("0") row_tan.SetValue("0") row_tov.SetValue("0") row_tod.SetValue("0") row = [row_id, row_sax, row_san, row_sol, row_sod, row_tan, row_tov, row_tod] return row
Example #22
Source File: gui.py From superpaper with MIT License | 5 votes |
def create_sizer_profiles(self): # choice menu self.list_of_profiles = list_profiles() self.profnames = [] for prof in self.list_of_profiles: self.profnames.append(prof.name) self.profnames.append("Create a new profile") self.choice_profiles = wx.Choice(self, -1, name="ProfileChoice", choices=self.profnames) self.choice_profiles.Bind(wx.EVT_CHOICE, self.onSelect) st_choice_profiles = wx.StaticText(self, -1, "Setting profiles:") # name txt ctrl st_name = wx.StaticText(self, -1, "Profile name:") self.tc_name = wx.TextCtrl(self, -1, size=(self.tc_width, -1)) self.tc_name.SetMaxLength(14) # buttons self.button_new = wx.Button(self, label="New") self.button_save = wx.Button(self, label="Save") self.button_delete = wx.Button(self, label="Delete") self.button_new.Bind(wx.EVT_BUTTON, self.onCreateNewProfile) self.button_save.Bind(wx.EVT_BUTTON, self.onSave) self.button_delete.Bind(wx.EVT_BUTTON, self.onDeleteProfile) # Add elements to the sizer self.sizer_profiles.Add(st_choice_profiles, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.choice_profiles, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(st_name, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.tc_name, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_new, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_save, 0, wx.CENTER|wx.ALL, 5) self.sizer_profiles.Add(self.button_delete, 0, wx.CENTER|wx.ALL, 5)
Example #23
Source File: gui.py From superpaper with MIT License | 5 votes |
def sizer_toggle_children(self, sizer, bool_state, toggle_cb=False): for child in sizer.GetChildren(): if child.IsSizer(): self.sizer_toggle_children(child.GetSizer(), bool_state) else: widget = child.GetWindow() if ( isinstance(widget, wx.TextCtrl) or isinstance(widget, wx.StaticText) or isinstance(widget, wx.Choice) or isinstance(widget, wx.Button) or isinstance(widget, wx.CheckBox) and toggle_cb ): widget.Enable(bool_state)
Example #24
Source File: settings.py From nuxhash with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, choices=[], fallbackChoice='', **kwargs): wx.Choice.__init__(self, *args, choices=choices, **kwargs) self._Choices = choices self._Fallback = fallbackChoice
Example #25
Source File: settings.py From nuxhash with GNU General Public License v3.0 | 5 votes |
def SetValue(self, value): if value in self._Choices: wx.Choice.SetSelection(self, self._Choices.index(value)) else: wx.Choice.SetSelection(self, self._Choices.index(self._Fallback))
Example #26
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, ops=[], *a, **k): ops = [[op for op in opset if op.in_toolbar] for opset in ops] BTToolBar.__init__(self, parent, ops=ops, *a, **k) self.stop_button = self.FindById(STOP_ID) self.start_button = self.FindById(START_ID) self.RemoveTool(START_ID) self.stop_start_position = self.GetToolPos(STOP_ID) ## self.priority = wx.Choice(parent=self, id=wx.ID_ANY, choices=[_("High"), _("Normal"), _("Low")]) ## self.priority.SetSelection(1) ## self.AddControl(self.priority) self.Realize()
Example #27
Source File: choice.py From wxGlade with MIT License | 5 votes |
def create_widget(self): choices = [c[0] for c in self.choices] self.widget = wx.Choice(self.parent_window.widget, self.id, choices=choices) self.widget.SetSelection(self.selection) self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
Example #28
Source File: DisplayChoice.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, value, *args, **kwargs): numDisplays = wx.Display().GetCount() choices = ["Monitor %d" % (i + 1) for i in range(numDisplays)] eg.Choice.__init__(self, parent, value, choices, *args, **kwargs)
Example #29
Source File: Choice.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__( self, parent, value, choices, pos=wx.DefaultPosition, size=wx.DefaultSize, *args, **kwargs ): wx.Choice.__init__( self, parent, -1, pos, size, choices, *args, **kwargs ) self.SetValue(value)
Example #30
Source File: SerialPortChoice.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__( self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name=wx.ChoiceNameStr, value=None ): """ :Parameters: `value` : int The initial port to select (0 = COM1:). The first available port will be selected if the given port does not exist or no value is given. """ ports = eg.SerialThread.GetAllPorts() self.ports = ports choices = [("COM%d" % (portnum + 1)) for portnum in ports] wx.Choice.__init__( self, parent, id, pos, size, choices, style, validator, name ) try: portPos = ports.index(value) except ValueError: portPos = 0 self.SetSelection(portPos)