本文整理汇总了Python中wx.EVT_COMBOBOX属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_COMBOBOX属性的具体用法?Python wx.EVT_COMBOBOX怎么用?Python wx.EVT_COMBOBOX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_COMBOBOX属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例2: crt_bitmap_combobox
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def crt_bitmap_combobox(self, choices, size=(-1, -1), event_handler=None):
combobox = wx.combo.BitmapComboBox(self, size=size, style=wx.CB_READONLY)
for item in choices:
lang_code, lang_name = item
_, country = lang_code.split('_')
if country in flagart.catalog:
flag_bmp = flagart.catalog[country].getBitmap()
else:
flag_bmp = flagart.catalog["BLANK"].getBitmap()
combobox.Append(lang_name, flag_bmp)
if event_handler is not None:
combobox.Bind(wx.EVT_COMBOBOX, event_handler)
return combobox
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def __init__(self, parent, name):
pre = wx.PrePanel()
g.frame.res.LoadOnPanel(pre, parent, 'PANEL_BITMAP')
self.PostCreate(pre)
self.modified = self.freeze = False
self.radio_std = xrc.XRCCTRL(self, 'RADIO_STD')
self.radio_file = xrc.XRCCTRL(self, 'RADIO_FILE')
self.combo = xrc.XRCCTRL(self, 'COMBO_STD')
self.text = xrc.XRCCTRL(self, 'TEXT_FILE')
self.button = xrc.XRCCTRL(self, 'BUTTON_BROWSE')
self.textModified = False
self.SetAutoLayout(True)
self.GetSizer().SetMinSize((260, -1))
self.GetSizer().Fit(self)
wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_STD'), self.OnRadioStd)
wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_FILE'), self.OnRadioFile)
wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_BROWSE'), self.OnButtonBrowse)
wx.EVT_COMBOBOX(self, xrc.XRCID('COMBO_STD'), self.OnCombo)
wx.EVT_TEXT(self, xrc.XRCID('COMBO_STD'), self.OnChange)
wx.EVT_TEXT(self, xrc.XRCID('TEXT_FILE'), self.OnChange)
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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()
示例5: addTypeCombo
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def __init__(self, avalaible_gpio, edit):
wx.Dialog.__init__(self, None, title=_('Add GPIO sensor'), size=(330, 265))
panel = wx.Panel(self)
wx.StaticText(panel, label=_('Name'), pos=(10, 10))
self.name = wx.TextCtrl(panel, size=(310, 30), pos=(10, 35))
wx.StaticText(panel, label=_('allowed characters: 0-9, a-z, A-Z'), pos=(10, 70))
list_io = [_('input'), _('output')]
wx.StaticText(panel, label=_('I/O'), pos=(10, 100))
self.io_select = wx.ComboBox(panel, choices=list_io, style=wx.CB_READONLY, size=(100, 32), pos=(10, 125))
self.io_select.Bind(wx.EVT_COMBOBOX, self.onSelectIO)
wx.StaticText(panel, label=_('GPIO'), pos=(115, 100))
self.gpio_select = wx.ComboBox(panel, choices=avalaible_gpio, style=wx.CB_READONLY, size=(100, 32),
pos=(115, 125))
list_pull = ['down', 'up']
wx.StaticText(panel, label=_('Pull'), pos=(220, 100))
self.pull_select = wx.ComboBox(panel, choices=list_pull, style=wx.CB_READONLY, size=(100, 32), pos=(220, 125))
if edit != 0:
self.name.SetValue(edit[1])
if edit[2] == 'out':
io = _('output')
self.pull_select.Disable()
else:
io = _('input')
self.pull_select.Enable()
self.io_select.SetValue(io)
self.gpio_select.SetValue(str(edit[3]))
self.pull_select.SetValue(edit[4])
cancelBtn = wx.Button(panel, wx.ID_CANCEL, pos=(70, 180))
okBtn = wx.Button(panel, wx.ID_OK, pos=(180, 180))
示例7: OnLivePlotting
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def OnLivePlotting(self,event):
"""
Turn on/off live plotting when parameters are changed.
Main plot updates in pseudo-realtime, rather than having to click 'compute' every time
This method binds or unbinds a call to the compute button each time a control is changed.
"""
LivePlotOn = bool(event.IsChecked())
if LivePlotOn:
for ctrl in self.ThyOptions.all_floatspin_inputs:
self.Bind(EVT_FLOATSPIN, self.OnComputeButton, ctrl)
for ctrl in self.ThyOptions.fixed_paramlist_inputs[0:2]:
self.Bind(wx.EVT_COMBOBOX, self.OnComputeButton, ctrl)
self.LiveEventsBound = True
else:
# unbind the events, if currently bound
if self.LiveEventsBound:
# unbind
for ctrl in self.ThyOptions.all_floatspin_inputs:
self.Unbind(EVT_FLOATSPIN, ctrl)
for ctrl in self.ThyOptions.fixed_paramlist_inputs[0:2]:
self.Unbind(EVT_FLOATSPIN, ctrl)
self.LiveEventsBound = False
示例8: _bindUI
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def _bindUI(self, field, key, section='chronolapse'):
"""
Creates a two way binding for the UI element and the given
section/key in the config.
"""
logging.debug("Binding %s[%s] to %s" % (section, key, str(field)))
if hasattr(field, 'SetValue'):
# if field is a checkbox, treat it differently
if hasattr(field, 'IsChecked'):
# on checkbox events, update the config
self.Bind(wx.EVT_CHECKBOX,
lambda event: self.updateConfig(
{key: field.IsChecked()}, from_ui=True),
field)
else:
# on text events, update the config
self.Bind(wx.EVT_TEXT,
lambda event: self.updateConfig(
{key: field.GetValue()}, from_ui=True),
field)
# on config changes, update the UI
self.config.add_listener(
section, key, lambda x: field.SetValue(x))
elif hasattr(field, 'SetStringSelection'):
# on Selection
self.Bind(wx.EVT_COMBOBOX,
lambda event: self.updateConfig(
{key: field.GetStringSelection()}, from_ui=True),
field)
# on config changes, update the UI
self.config.add_listener(
section, key, lambda x: field.SetStringSelection(str(x)))
示例9: _on_left_down
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def _on_left_down(self, event):
self.value = self.curitem
self.Dismiss()
# Send EVT_COMBOBOX to inform the parent for changes
wx.PostEvent(self, self.EVENTS_TABLE["EVT_COMBOBOX"])
示例10: _propagate
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def _propagate(self, event):
if event.GetEventType() == wx.EVT_COMBOBOX.typeId:
self.textctrl.SetValue(self.listbox.GetStringValue())
wx.PostEvent(self, event)
示例11: crt_combobox
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def crt_combobox(self, choices, size=(-1, -1), event_handler=None):
combobox = wx.ComboBox(self, choices=choices, size=size, style=wx.CB_READONLY)
if event_handler is not None:
combobox.Bind(wx.EVT_COMBOBOX, event_handler)
return combobox
示例12: _on_language
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def _on_language(self, event):
"""Event handler for the wx.EVT_COMBOBOX of the language_combobox."""
wx.MessageBox(_("In order for the changes to take effect please restart {0}").format(__appname__),
_("Restart"),
wx.OK | wx.ICON_INFORMATION,
self)
示例13: _on_subtitles
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def _on_subtitles(self, event):
"""Event handler for the wx.EVT_COMBOBOX of the subtitles_combobox."""
self.subtitles_lang_listbox.Enable(self.subtitles_combobox.GetValue() == self.SUBS_CHOICES[-1])
示例14: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def __init__(self, parent, board):
wx.Frame.__init__(self, parent, title="this is the title")
self.panel = wx.Panel(self)
label = wx.StaticText(self.panel, label = "Hello World")
button = wx.Button(self.panel, label="Button label", id=1)
nets = board.GetNetsByName()
self.netnames = []
for netname, net in nets.items():
if (str(netname) == ""):
continue
self.netnames.append(str(netname))
netcb = wx.ComboBox(self.panel, choices=self.netnames)
netcb.SetSelection(0)
netsbox = wx.BoxSizer(wx.HORIZONTAL)
netsbox.Add(wx.StaticText(self.panel, label="Nets:"))
netsbox.Add(netcb, proportion=1)
modules = board.GetModules()
self.modulenames = []
for mod in modules:
self.modulenames.append("{}({})".format(mod.GetReference(), mod.GetValue()))
modcb = wx.ComboBox(self.panel, choices=self.modulenames)
modcb.SetSelection(0)
modsbox = wx.BoxSizer(wx.HORIZONTAL)
modsbox.Add(wx.StaticText(self.panel, label="Modules:"))
modsbox.Add(modcb, proportion=1)
box = wx.BoxSizer(wx.VERTICAL)
box.Add(label, proportion=0)
box.Add(button, proportion=0)
box.Add(netsbox, proportion=0)
box.Add(modsbox, proportion=0)
self.panel.SetSizer(box)
self.Bind(wx.EVT_BUTTON, self.OnPress, id=1)
self.Bind(wx.EVT_COMBOBOX, self.OnSelectNet, id=netcb.GetId())
self.Bind(wx.EVT_COMBOBOX, self.OnSelectMod, id=modcb.GetId())
示例15: _bind
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_COMBOBOX [as 别名]
def _bind(self, ctlName, evt=None, proc=None):
if isinstance(ctlName, wx.PyEventBinder): # binding to self
ctl=super(wx.Window, self)
proc=evt
evt=ctlName
elif isinstance(ctlName, wx.Window):
ctl=ctlName
else:
ctl=self[ctlName]
if not proc:
if not isinstance(evt, wx.PyEventBinder):
proc=evt
evt=None
if not proc:
proc=self.OnCheck
if not evt:
if isinstance(ctl, wx.Button):
evt=wx.EVT_BUTTON
elif isinstance(ctl, wx.CheckBox):
evt=wx.EVT_CHECKBOX
elif isinstance(ctl, wx.CheckListBox):
evt=wx.EVT_CHECKLISTBOX
elif isinstance(ctl, wx.RadioButton):
evt=wx.EVT_RADIOBUTTON
else:
evt=wx.EVT_TEXT
if isinstance(ctl, wx.ComboBox):
ctl.Bind(wx.EVT_COMBOBOX, proc)
ctl.Bind(evt, proc)