本文整理汇总了Python中wx.ComboBox方法的典型用法代码示例。如果您正苦于以下问题:Python wx.ComboBox方法的具体用法?Python wx.ComboBox怎么用?Python wx.ComboBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.ComboBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addCombo
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def addCombo(self, name, descr, parent, sizer, items, sel):
al = wx.ALIGN_CENTER_VERTICAL | wx.RIGHT
if sel == 1:
al |= wx.ALIGN_RIGHT
sizer.Add(wx.StaticText(parent, -1, descr), 0, al, 10)
combo = wx.ComboBox(parent, -1, style = wx.CB_READONLY)
util.setWH(combo, w = 200)
for s in items:
combo.Append(s)
combo.SetSelection(sel)
sizer.Add(combo)
setattr(self, name + "Combo", combo)
示例2: createControls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def createControls(self):
self.flagOptionsLabel = wx.StaticText(self, label="Flagging methods:")
self.flagOutlierButton = wx.Button(self,-1,"Flag Outlier",size=(160,30))
self.flagRangeButton = wx.Button(self,-1,"Flag Range",size=(160,30))
self.flagMinButton = wx.Button(self,-1,"Flag Minimum",size=(160,30))
self.flagMaxButton = wx.Button(self,-1,"Flag Maximum",size=(160,30))
self.xCheckBox = wx.CheckBox(self,label="X ")
self.yCheckBox = wx.CheckBox(self,label="Y ")
self.zCheckBox = wx.CheckBox(self,label="Z ")
self.fCheckBox = wx.CheckBox(self,label="F ")
self.FlagIDText = wx.StaticText(self,label="Select Min/Max Flag ID:")
self.FlagIDComboBox = wx.ComboBox(self, choices=self.flagidlist,
style=wx.CB_DROPDOWN, value=self.flagidlist[3],size=(160,-1))
self.flagSelectionButton = wx.Button(self,-1,"Flag Selection",size=(160,30))
self.flagDropButton = wx.Button(self,-1,"Drop flagged",size=(160,30))
self.flagLoadButton = wx.Button(self,-1,"Load flags",size=(160,30))
self.flagSaveButton = wx.Button(self,-1,"Save flags",size=(160,30))
self.flagClearButton = wx.Button(self,-1,"Clear flags",size=(160,30))
示例3: addStaticBoxWithLabels
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def addStaticBoxWithLabels(self):
boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
staticBox = wx.StaticBox( self.panel, -1, "Labels within a Frame" )
staticBoxSizerV = wx.StaticBoxSizer( staticBox, wx.VERTICAL )
boxSizerV = wx.BoxSizer( wx.VERTICAL )
staticText1 = wx.StaticText( self.panel, -1, " Choose a number:" )
boxSizerV.Add( staticText1, 0, wx.ALL)
staticText2 = wx.StaticText( self.panel, -1, " Label 2")
boxSizerV.Add( staticText2, 0, wx.ALL )
#------------------------------------------------------
staticBoxSizerV.Add( boxSizerV, 0, wx.ALL )
boxSizerH.Add(staticBoxSizerV)
#------------------------------------------------------
boxSizerH.Add(wx.ComboBox(self.panel, size=(70, -1)))
#------------------------------------------------------
boxSizerH.Add(wx.SpinCtrl(self.panel, size=(50, -1), style=wx.BORDER_RAISED))
# Add local boxSizer to main frame
self.statBoxSizerV.Add( boxSizerH, 1, wx.ALL )
#----------------------------------------------------------
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:23,代码来源:GUI_wxPython.py
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def __init__(self, parent, title, current_language):
style = wx.DEFAULT_DIALOG_STYLE
vbox = wx.BoxSizer(wx.VERTICAL)
wx.Dialog.__init__(self, parent, -1, title, style=style)
self.lbl = wx.StaticText(self, -1,
_("Choose language (requires restart to take full effect)"))
vbox.Add(self.lbl, 0, wx.ALL, 10)
self.language_choices = wx.ComboBox(self, -1,
choices=sorted(LANGUAGES.keys()),
style=wx.CB_READONLY)
self.language_choices.SetStringSelection(LANGUAGES_REVERSE[current_language])
vbox.Add(self.language_choices, 0, wx.ALL, 10)
buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
vbox.Add(buttons, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 10)
self.SetSizerAndFit(vbox)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: webcamConfigDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.testwebcambutton = wx.Button(self, wx.ID_ANY, _("Test Webcam"))
self.webcamtimestampcheck = wx.CheckBox(self, wx.ID_ANY, _("Show Timestamp"))
self.label_16 = wx.StaticText(self, wx.ID_ANY, _("Format:"))
self.webcam_timestamp_format = wx.TextCtrl(self, wx.ID_ANY, _("%Y-%m-%d %H:%M:%S"))
self.label_9 = wx.StaticText(self, wx.ID_ANY, _("File Prefix:"))
self.webcamprefixtext = wx.TextCtrl(self, wx.ID_ANY, _("cam_"))
self.label_10 = wx.StaticText(self, wx.ID_ANY, _("Save Folder:"))
self.webcamsavefoldertext = wx.TextCtrl(self, wx.ID_ANY, "")
self.webcamsavefolderbrowse = wx.Button(self, wx.ID_ANY, _("..."))
self.label_11 = wx.StaticText(self, wx.ID_ANY, _("File Format:"))
self.webcamformatcombo = wx.ComboBox(self, wx.ID_ANY, choices=[_("jpg"), _("png"), _("gif")], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN)
self.webcamsavebutton = wx.Button(self, wx.ID_OK, "")
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.testWebcamPressed, self.testwebcambutton)
self.Bind(wx.EVT_BUTTON, self.webcamSaveFolderBrowse, self.webcamsavefolderbrowse)
# end wxGlade
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def __init__(self, parent):
wx.Dialog.__init__(self, parent, wx.ID_ANY, "Manual Entry", size=(650, 600))
self.panel = wx.Panel(self, wx.ID_ANY)
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
self.folios = self.fetchFolios()
self.lblFolioD = wx.StaticText(self.panel, label="Folio (Debit)")
self.folioComboD = wx.ComboBox(self.panel, choices=list(self.folios.keys()))
self.mainSizer.Add(self.lblFolioD)
self.mainSizer.Add(self.folioComboD)
self.SetSizer(self.mainSizer)
self.Layout()
self.mainSizer.Fit(self.panel)
self.Centre(wx.BOTH)
self.Bind(wx.EVT_CLOSE, self.OnQuit)
self.Show()
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def __init__(self, parent, columns, df_list_ctrl):
wx.Panel.__init__(self, parent)
columns_with_neutral_selection = [''] + list(columns)
self.columns = columns
self.df_list_ctrl = df_list_ctrl
self.figure = Figure(facecolor="white", figsize=(1, 1))
self.axes = self.figure.add_subplot(111)
self.canvas = FigureCanvas(self, -1, self.figure)
chart_toolbar = NavigationToolbar2Wx(self.canvas)
self.combo_box1 = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.on_combo_box_select)
row_sizer = wx.BoxSizer(wx.HORIZONTAL)
row_sizer.Add(self.combo_box1, 0, wx.ALL | wx.ALIGN_CENTER, 5)
row_sizer.Add(chart_toolbar, 0, wx.ALL, 5)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.canvas, 1, flag=wx.EXPAND, border=5)
sizer.Add(row_sizer)
self.SetSizer(sizer)
示例8: GetTransitionType
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def GetTransitionType(self):
"""
Return type selected for SFC transition and associated value
@return: Type selected and associated value (None if no value)
"""
# Go through radio buttons and return type and value associated to the
# one that is selected
for type, (radio, control) in self.TypeRadioButtons.iteritems():
if radio.GetValue():
if isinstance(control, wx.ComboBox):
return type, control.GetStringSelection()
elif isinstance(control, wx.TextCtrl):
return type, control.GetValue()
else:
return type, None
return None, None
示例9: ClearHighlights
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def ClearHighlights(self, highlight_type=None):
if highlight_type is None:
self.Highlights = []
else:
self.Highlights = [(infos, start, end, highlight) for (infos, start, end, highlight) in self.Highlights if highlight != highlight_type]
for control in self.HighlightControls.itervalues():
if isinstance(control, (wx.ComboBox, wx.SpinCtrl)):
control.SetBackgroundColour(wx.NullColour)
control.SetForegroundColour(wx.NullColour)
elif isinstance(control, wx.TextCtrl):
value = control.GetValueStr() if isinstance(control, CustomIntCtrl) else \
control.GetValue()
control.SetStyle(0, len(value), wx.TextAttr(wx.NullColour))
elif isinstance(control, wx.gizmos.EditableListBox):
listctrl = control.GetListCtrl()
for i in xrange(listctrl.GetItemCount()):
listctrl.SetItemBackgroundColour(i, wx.NullColour)
listctrl.SetItemTextColour(i, wx.NullColour)
self.StructureElementsTable.ClearHighlights(highlight_type)
self.RefreshView()
示例10: ShowHighlights
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def ShowHighlights(self):
type_infos = self.Controler.GetDataTypeInfos(self.TagName)
for infos, start, end, highlight_type in self.Highlights:
if infos[0] == "struct":
self.StructureElementsTable.AddHighlight(infos[1:], highlight_type)
else:
control = self.HighlightControls.get((type_infos["type"], infos[0]), None)
if control is not None:
if isinstance(control, (wx.ComboBox, wx.SpinCtrl)):
control.SetBackgroundColour(highlight_type[0])
control.SetForegroundColour(highlight_type[1])
elif isinstance(control, wx.TextCtrl):
control.SetStyle(start[1], end[1] + 1, wx.TextAttr(highlight_type[1], highlight_type[0]))
elif isinstance(control, wx.gizmos.EditableListBox):
listctrl = control.GetListCtrl()
listctrl.SetItemBackgroundColour(infos[1], highlight_type[0])
listctrl.SetItemTextColour(infos[1], highlight_type[1])
listctrl.Select(listctrl.FocusedItem, False)
示例11: build
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def build(self, parent, data, choices=None):
self.widget = wx.ComboBox(
parent=parent,
id=-1,
value=self.default_value,
choices=[self.default_value] + choices,
style=wx.CB_DROPDOWN
)
return self.widget
示例12: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def __init__(self, parent, id, cfg):
wx.Panel.__init__(self, parent, id)
self.cfg = cfg
vsizer = wx.BoxSizer(wx.VERTICAL)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
hsizer.Add(wx.StaticText(self, -1, "Element:"), 0,
wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10)
self.elementsCombo = wx.ComboBox(self, -1, style = wx.CB_READONLY)
for t in config.getTIs():
self.elementsCombo.Append(t.name, t.lt)
hsizer.Add(self.elementsCombo, 0)
vsizer.Add(hsizer, 0, wx.EXPAND)
vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
gsizer = wx.FlexGridSizer(0, 2, 5, 0)
self.addTypeCombo("newEnter", "Enter creates", self, gsizer)
self.addTypeCombo("newTab", "Tab creates", self, gsizer)
self.addTypeCombo("nextTab", "Tab switches to", self, gsizer)
self.addTypeCombo("prevTab", "Shift+Tab switches to", self, gsizer)
vsizer.Add(gsizer)
util.finishWindow(self, vsizer, center = False)
wx.EVT_COMBOBOX(self, self.elementsCombo.GetId(), self.OnElementCombo)
self.elementsCombo.SetSelection(0)
self.OnElementCombo()
示例13: addTypeCombo
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def addTypeCombo(self, name, descr, parent, sizer):
sizer.Add(wx.StaticText(parent, -1, descr + ":"), 0,
wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10)
combo = wx.ComboBox(parent, -1, style = wx.CB_READONLY)
for t in config.getTIs():
combo.Append(t.name, t.lt)
sizer.Add(combo)
wx.EVT_COMBOBOX(self, combo.GetId(), self.OnMisc)
setattr(self, name + "Combo", combo)
示例14: createControls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def createControls(self):
self.sourceLabel = wx.StaticText(self, label="Data source:")
self.diLabel = wx.StaticText(self, label="Actions:")
self.loadDIButton = wx.Button(self,-1,"DI data",size=(160,30))
self.diSourceLabel = wx.StaticText(self, label="Source: None")
self.diTextCtrl = wx.TextCtrl(self, value="None",size=(160,40),
style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL|wx.VSCROLL)
self.defineVarioScalarButton = wx.Button(self,-1,"Vario/Scalar",size=(160,30))
self.VarioSourceLabel = wx.StaticText(self, label="Vario: None")
self.ScalarSourceLabel = wx.StaticText(self, label="Scalar: None")
self.varioTextCtrl = wx.TextCtrl(self, value="None",size=(160,40),
style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL|wx.VSCROLL)
self.defineParameterButton = wx.Button(self,-1,"Analysis parameter",size=(160,30))
self.parameterRadioBox = wx.RadioBox(self,label="parameter source",choices=self.choices, majorDimension=2, style=wx.RA_SPECIFY_COLS,size=(160,50))
#self.parameterTextCtrl = wx.TextCtrl(self, value="Default",size=(160,30),
# style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL|wx.VSCROLL)
self.scalarTextCtrl = wx.TextCtrl(self, value="None",size=(160,40),
style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL|wx.VSCROLL)
self.AnalyzeButton = wx.Button(self,-1,"Analyze",size=(160,30))
self.logLabel = wx.StaticText(self, label="Logging:")
#self.exportButton = wx.Button(self,-1,"Export...",size=(160,30))
self.ClearLogButton = wx.Button(self,-1,"Clear Log",size=(160,30))
self.SaveLogButton = wx.Button(self,-1,"Save Log",size=(160,30))
self.dilogTextCtrl = wx.TextCtrl(self, wx.ID_ANY, size=(330,200),
style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL|wx.VSCROLL)
#self.varioExtComboBox = wx.ComboBox(self, choices=self.varioext,
# style=wx.CB_DROPDOWN, value=self.varioext[0],size=(160,-1))
#self.scalarExtComboBox = wx.ComboBox(self, choices=self.scalarext,
# style=wx.CB_DROPDOWN, value=self.scalarext[0],size=(160,-1))
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ComboBox [as 别名]
def __init__(self, edit):
if edit == 0: title = _('Add 1W temperature sensor')
else: title = _('Edit 1W temperature sensor')
wx.Dialog.__init__(self, None, title = title, size=(430, 250))
panel = wx.Panel(self)
wx.StaticText(panel, label=_('Signal K key'), pos=(10, 10))
self.SKkey = wx.TextCtrl(panel, style=wx.CB_READONLY, size=(300, 30), pos=(10, 35))
self.edit_skkey = wx.Button(panel, label=_('Edit'), pos=(320, 32))
self.edit_skkey.Bind(wx.EVT_BUTTON, self.onEditSkkey)
wx.StaticText(panel, label=_('Name'), pos=(10, 75))
self.name = wx.TextCtrl(panel, size=(150, 30), pos=(10, 100))
wx.StaticText(panel, label=_('allowed characters: 0-9, a-z, A-Z'), pos=(10, 135))
list_id = []
for sensor in W1ThermSensor.get_available_sensors():
list_id.append(sensor.id)
wx.StaticText(panel, label=_('Sensor ID'), pos=(190, 75))
self.id_select = wx.ComboBox(panel, choices=list_id, style=wx.CB_READONLY, size=(150, 32), pos=(190, 100))
wx.StaticText(panel, label=_('Offset'), pos=(370, 75))
self.offset = wx.TextCtrl(panel, size=(50, 30), pos=(370, 100))
if edit != 0:
self.name.SetValue(edit[1])
self.SKkey.SetValue(edit[2])
self.id_select.SetValue(edit[3])
self.offset.SetValue(edit[4])
cancelBtn = wx.Button(panel, wx.ID_CANCEL, pos=(115, 175))
okBtn = wx.Button(panel, wx.ID_OK, pos=(235, 175))