本文整理汇总了Python中wx.EVT_CHOICE属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_CHOICE属性的具体用法?Python wx.EVT_CHOICE怎么用?Python wx.EVT_CHOICE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_CHOICE属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: row_box
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
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
#---------------------------------------------
示例2: set_events
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
def set_events(self):
'''
@summary: Set GUI events for the various controls
'''
# Catch Language choice changes
self.Bind(wx.EVT_CHOICE, self.update_language, self.BuilderLanguageChoice)
# Catch config file load and save
self.Bind(wx.EVT_FILEPICKER_CHANGED, self.__load_config, self.LoadFilePicker)
self.Bind(wx.EVT_FILEPICKER_CHANGED, self.__save_config, self.SaveFilePicker)
# BUILD button
self.Bind(wx.EVT_BUTTON, self.__start_build, self.BuildButton)
# Mainframe close
self.Bind(wx.EVT_CLOSE, self.__close_builder, self)
# Disable Open Containing Folder Button and bind event
self.OpenContainingFolderButton.Disable()
self.Bind(wx.EVT_BUTTON, self.__open_containing_folder, self.OpenContainingFolderButton)
示例3: create_sizer_profiles
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
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)
示例4: FinishSetup
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
def FinishSetup(self):
self.shown = True
if self.lines:
self.AddGrid(self.lines, *self.sizerProps)
spaceSizer = wx.BoxSizer(wx.HORIZONTAL)
spaceSizer.Add((2, 2))
spaceSizer.Add(self.sizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
spaceSizer.Add((4, 4))
self.SetSizerAndFit(spaceSizer)
#self.dialog.FinishSetup()
def OnEvent(dummyEvent):
self.SetIsDirty()
self.Bind(wx.EVT_CHECKBOX, OnEvent)
self.Bind(wx.EVT_BUTTON, OnEvent)
self.Bind(wx.EVT_CHOICE, OnEvent)
self.Bind(wx.EVT_TOGGLEBUTTON, OnEvent)
self.Bind(wx.EVT_TEXT, OnEvent)
self.Bind(wx.EVT_RADIOBOX, OnEvent)
self.Bind(wx.EVT_RADIOBUTTON, OnEvent)
self.Bind(wx.EVT_TREE_SEL_CHANGED, OnEvent)
self.Bind(wx.EVT_DATE_CHANGED, OnEvent)
self.Bind(eg.EVT_VALUE_CHANGED, OnEvent)
self.Bind(wx.EVT_CHECKLISTBOX, OnEvent)
self.Bind(wx.EVT_SCROLL, OnEvent)
self.Bind(wx.EVT_LISTBOX, OnEvent)
示例5: _init_ctrls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
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)
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
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()
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
def __init__(self, parent, eventHandler):
Monitor.__init__(self, None, False, False, None, None, False, [], [])
self._eventHandler = eventHandler
self._isRecording = False
self._isRunning = False
self._isLow = True
self._colours = []
pre = wx.PrePanel()
self._ui = load_ui('PanelMonitor.xrc')
handlerNumCtrl = XrcHandlerNumCtrl()
handlerMeter = XrcHandlerMeter()
self._ui.AddHandler(handlerNumCtrl)
self._ui.AddHandler(handlerMeter)
self._ui.LoadOnPanel(pre, parent, 'PanelMonitor')
self.PostCreate(pre)
self._panelColour = xrc.XRCCTRL(pre, 'panelColour')
self._checkEnable = xrc.XRCCTRL(pre, 'checkEnable')
self._checkAlert = xrc.XRCCTRL(pre, 'checkAlert')
self._checkDynamic = xrc.XRCCTRL(pre, 'checkDynamic')
self._choiceFreq = xrc.XRCCTRL(pre, 'choiceFreq')
self._textSignals = xrc.XRCCTRL(pre, 'textSignals')
# TODO: hackish
for child in self.GetChildren():
if isinstance(child, WidgetMeter):
self._meterLevel = child
self._sliderThreshold = xrc.XRCCTRL(pre, 'sliderThreshold')
self._buttonDel = xrc.XRCCTRL(pre, 'buttonDel')
self.__set_records()
self._on_del = None
self._panelColour.Bind(wx.EVT_LEFT_UP, self.__on_colour)
self.Bind(wx.EVT_CHECKBOX, self.__on_enable, self._checkEnable)
self.Bind(wx.EVT_CHECKBOX, self.__on_alert, self._checkAlert)
self.Bind(wx.EVT_CHECKBOX, self.__on_dynamic, self._checkDynamic)
self.Bind(wx.EVT_CHOICE, self.__on_freq, self._choiceFreq)
self.Bind(wx.EVT_SLIDER, self.__on_threshold, self._sliderThreshold)
self.Bind(wx.EVT_BUTTON, self.__on_del, self._buttonDel)
示例8: SetupToolBar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
def SetupToolBar(self):
"""Create the toolbar for common actions"""
tb = self.CreateToolBar(self.TBFLAGS)
tsize = (24, 24)
tb.ToolBitmapSize = tsize
open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR,
tsize)
tb.AddLabelTool(ID_OPEN, "Open", open_bmp, shortHelp="Open",
longHelp="Open a (c)Profile trace file")
if not osx:
tb.AddSeparator()
# self.Bind(wx.EVT_TOOL, self.OnOpenFile, id=ID_OPEN)
self.rootViewTool = tb.AddLabelTool(
ID_ROOT_VIEW, _("Root View"),
wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR, tsize),
shortHelp=_("Display the root of the current view tree (home view)")
)
self.rootViewTool = tb.AddLabelTool(
ID_BACK_VIEW, _("Back"),
wx.ArtProvider.GetBitmap(wx.ART_GO_BACK, wx.ART_TOOLBAR, tsize),
shortHelp=_("Back to the previously activated node in the call tree")
)
self.upViewTool = tb.AddLabelTool(
ID_UP_VIEW, _("Up"),
wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_TOOLBAR, tsize),
shortHelp=_("Go one level up the call tree (highest-percentage parent)")
)
if not osx:
tb.AddSeparator()
# TODO: figure out why the control is sizing the label incorrectly on Linux
self.percentageViewTool = wx.CheckBox(tb, -1, _("Percent "))
self.percentageViewTool.SetToolTip(wx.ToolTip(
_("Toggle display of percentages in list views")))
tb.AddControl(self.percentageViewTool)
wx.EVT_CHECKBOX(self.percentageViewTool,
self.percentageViewTool.GetId(), self.OnPercentageView)
self.viewTypeTool= wx.Choice( tb, -1, choices= getattr(self.loader,'ROOTS',[]) )
self.viewTypeTool.SetToolTip(wx.ToolTip(
_("Switch between different hierarchic views of the data")))
wx.EVT_CHOICE( self.viewTypeTool, self.viewTypeTool.GetId(), self.OnViewTypeTool )
tb.AddControl( self.viewTypeTool )
tb.Realize()
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
def __init__(self, parent, *a, **k):
wx.Panel.__init__(self, parent, *a, **k)
self.sizer = VSizer()
self.SetSizer(self.sizer)
if 'errback' in k:
self.errback = k.pop('errback')
else:
self.errback = self.set_language_failed
# widgets
self.box = wx.StaticBox(self, label="Translate %s into:" % app_name)
self.language_names = ["System default",] + [language_names[l] for l in languages]
languages.insert(0, '')
self.languages = languages
self.choice = wx.Choice(self, choices=self.language_names)
self.Bind(wx.EVT_CHOICE, self.set_language, self.choice)
restart = wx.StaticText(self, -1,
"You must restart %s for the\nlanguage "
"setting to take effect." % app_name)
self.bottom_error = wx.StaticText(self, -1, '')
self.bottom_error.SetForegroundColour(error_color)
# sizers
self.box_sizer = wx.StaticBoxSizer(self.box, wx.VERTICAL)
# set menu selection and warning item if necessary
self.valid = True
lang = read_language_file()
if lang is not None:
try:
i = self.languages.index(lang)
self.choice.SetSelection(i)
except ValueError, e:
self.top_error = wx.StaticText(self, -1,
"This version of %s does not \nsupport the language '%s'."%(app_name,lang),)
self.top_error.SetForegroundColour(error_color)
self.box_sizer.Add(self.top_error, flag=wx.TOP|wx.LEFT|wx.RIGHT, border=SPACING)
# BUG add menu separator
# BUG change color of extra menu item
self.choice.Append(lang)
self.choice.SetSelection(len(self.languages))
self.valid = False
示例10: Labeled_Droplist
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
def Labeled_Droplist(frame, panel, sizer, \
label, choice_list, function, \
button1=None, b1_function=None, \
button2=None, b2_function=None, \
box_width=280, border=5, \
choice_number=0):
L1 = wx.StaticText(panel, -1, label)
sizer.Add(L1, 0, wx.ALL, border)
D1 = wx.Choice(panel, -1, choices=choice_list, \
size=(box_width, -1))
D1.Select(choice_number)
sizer.Add(D1, 0, wx.ALL, border)
frame.Bind(wx.EVT_CHOICE, function, D1)
#---------------------------
# Option to add 1st button
#---------------------------
if (button1 is None):
null_item1 = wx.StaticText(panel, -1, "")
sizer.Add(null_item1, 0, wx.ALL, border)
else:
B1 = wx.Button(panel, -1, button1)
sizer.Add(B1, 0, wx.ALL, border)
frame.Bind(wx.EVT_BUTTON, b1_function, B1)
#---------------------------
# Option to add 2nd button
#---------------------------
if (button2 is None):
null_item2 = wx.StaticText(panel, -1, "")
sizer.Add(null_item2, 0, wx.ALL, border)
else:
B2 = wx.Button(panel, -1, button2)
sizer.Add(B2, 0, wx.ALL, border)
frame.Bind(wx.EVT_BUTTON, b2_function, B2)
return D1 # (droplist object)
# Labeled_Droplist
#----------------------------------------------------------------
示例11: Configure
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
def Configure(self, mode = 0, state = 0):
self.stt = state
panel=eg.ConfigPanel(self)
topSizer = wx.StaticBoxSizer(
wx.StaticBox(panel, -1, self.text.rbLabel),
wx.VERTICAL
)
boolSizer = wx.BoxSizer(wx.HORIZONTAL)
rb0 = panel.RadioButton(mode==0, self.text.numVal, style=wx.RB_GROUP)
rb1 = panel.RadioButton(mode==1, self.text.strVal)
rb2 = panel.RadioButton(mode==2, self.text.boolVal)
statChoice = wx.Choice(panel, -1, choices = self.text.states)
statChoice.Select(state)
boolSizer.Add(rb2,0,wx.TOP,3)
boolSizer.Add(statChoice)
topSizer.Add(rb0,0,wx.TOP,3)
topSizer.Add(rb1,0,wx.TOP,7)
topSizer.Add(boolSizer,0,wx.TOP,5)
panel.sizer.Add(topSizer)
def onState(evt):
self.stt = evt.GetSelection()
evt.Skip()
statChoice.Bind(wx.EVT_CHOICE, onState)
def onRadio(evt = None):
flg = rb2.GetValue()
statChoice.Enable(flg)
sel = self.stt if flg else -1
statChoice.SetSelection(sel)
if evt:
evt.Skip()
rb0.Bind(wx.EVT_RADIOBUTTON, onRadio)
rb1.Bind(wx.EVT_RADIOBUTTON, onRadio)
rb2.Bind(wx.EVT_RADIOBUTTON, onRadio)
onRadio()
while panel.Affirmed():
state = state if self.stt == -1 else self.stt
panel.SetResult(
(rb0.GetValue(),rb1.GetValue(),rb2.GetValue()).index(True),
state,
)
#===============================================================================
示例12: setup_toolbar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHOICE [as 别名]
def setup_toolbar(self):
btn = self.toolbar.AddLabelTool(
id=-1,
label="Load file",
bitmap=icons.hkl_file.GetBitmap(),
shortHelp="Load file",
kind=wx.ITEM_NORMAL,
)
self.Bind(wx.EVT_MENU, self.OnLoadFile, btn)
btn = self.toolbar.AddLabelTool(
id=-1,
label="Settings",
bitmap=icons.advancedsettings.GetBitmap(),
shortHelp="Settings",
kind=wx.ITEM_NORMAL,
)
self.Bind(wx.EVT_MENU, self.OnShowSettings, btn)
btn = self.toolbar.AddLabelTool(
id=-1,
label="Zoom",
bitmap=icons.search.GetBitmap(),
shortHelp="Zoom",
kind=wx.ITEM_NORMAL,
)
self.Bind(wx.EVT_MENU, self.OnZoom, btn)
txt = wx.StaticText(self.toolbar, -1, "Image:")
self.toolbar.AddControl(txt)
self.image_chooser = wx.Choice(self.toolbar, -1, size=(300, -1))
self.toolbar.AddControl(self.image_chooser)
self.Bind(wx.EVT_CHOICE, self.OnChooseImage, self.image_chooser)
btn = self.toolbar.AddLabelTool(
id=wx.ID_BACKWARD,
label="Previous",
bitmap=bitmaps.fetch_icon_bitmap("actions", "1leftarrow"),
shortHelp="Previous",
kind=wx.ITEM_NORMAL,
)
self.Bind(wx.EVT_MENU, self.OnPrevious, btn)
btn = self.toolbar.AddLabelTool(
id=wx.ID_FORWARD,
label="Next",
bitmap=bitmaps.fetch_icon_bitmap("actions", "1rightarrow"),
shortHelp="Next",
kind=wx.ITEM_NORMAL,
)
self.Bind(wx.EVT_MENU, self.OnNext, btn)