本文整理汇总了Python中wx.EVT_RADIOBUTTON属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_RADIOBUTTON属性的具体用法?Python wx.EVT_RADIOBUTTON怎么用?Python wx.EVT_RADIOBUTTON使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_RADIOBUTTON属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AddSelector
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def AddSelector(self, name, binding=None):
if (binding == None):
binding = self.OnButton
if (not self.singleton):
rb = wx.CheckBox(self, label=name)
rb.Bind(wx.EVT_CHECKBOX, binding)
elif (len(self.boxes) == 0):
# boxes gets updated in Add
rb = wx.RadioButton(self.scrolled, label=name, style=wx.RB_GROUP)
rb.Bind(wx.EVT_RADIOBUTTON, binding)
self.SendSelectorEvent(rb)
else:
rb = wx.RadioButton(self.scrolled, label=name)
rb.Bind(wx.EVT_RADIOBUTTON, binding)
self.Add(rb)
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [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)
示例3: do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def do_layout(self, parent, titles, msgs):
self.panel = wx.Panel(parent)
self.radio_buttons = [wx.RadioButton(self.panel, -1) for _ in titles]
self.btn_names = [wx.StaticText(self.panel, label=title.title()) for title in titles]
self.help_msgs = [wx.StaticText(self.panel, label=msg.title()) for msg in msgs]
# box = wx.StaticBox(self.panel, -1, label=self.data['group_name'])
box = wx.StaticBox(self.panel, -1, label='')
vertical_container = wx.StaticBoxSizer(box, wx.VERTICAL)
for button, name, help in zip(self.radio_buttons, self.btn_names, self.help_msgs):
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(button, 0, wx.ALIGN_TOP | wx.ALIGN_LEFT)
hbox.Add(name, 0, wx.LEFT, 10)
vertical_container.Add(hbox, 0, wx.EXPAND)
vertical_container.Add(help, 1, wx.EXPAND | wx.LEFT, 25)
vertical_container.AddSpacer(5)
self.panel.SetSizer(vertical_container)
self.panel.Bind(wx.EVT_SIZE, self.onResize)
self.panel.Bind(wx.EVT_RADIOBUTTON, self.showz)
return self.panel
示例4: do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def do_layout(self, parent):
self.panel = wx.Panel(parent)
self.radio_buttons = [wx.RadioButton(self.panel, -1) for _ in self.data]
self.btn_names = [wx.StaticText(self.panel, label=btn_data['display_name'].title()) for btn_data in self.data]
self.help_msgs = [wx.StaticText(self.panel, label=btn_data['help'].title()) for btn_data in self.data]
self.option_stings = [btn_data['commands'] for btn_data in self.data]
# box = wx.StaticBox(self.panel, -1, label=self.data['group_name'])
box = wx.StaticBox(self.panel, -1, label='Set Verbosity Level')
vertical_container = wx.StaticBoxSizer(box, wx.VERTICAL)
for button, name, help in zip(self.radio_buttons, self.btn_names, self.help_msgs):
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(button, 0, wx.ALIGN_TOP | wx.ALIGN_LEFT)
hbox.Add(name, 0, wx.LEFT, 10)
vertical_container.Add(hbox, 0, wx.EXPAND)
vertical_container.Add(help, 1, wx.EXPAND | wx.LEFT, 25)
vertical_container.AddSpacer(5)
# self.panel.Bind(wx.EVT_RADIOBUTTON, self.onSetter, button)
self.panel.SetSizer(vertical_container)
self.panel.Bind(wx.EVT_SIZE, self.onResize)
return self.panel
示例5: _FileDiaryOptionsMenu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def _FileDiaryOptionsMenu(self, event):
# Grab the controls
author_name_box = self.frame.FindWindowById(self.author_name_id)
author_global_radio = self.frame.FindWindowById(self.author_global_id)
author_per_entry_radio = \
self.frame.FindWindowById(self.author_per_entry_id)
# Enable/disable the author name box
def _ChooseAuthorGlobal(event2):
author_name_box.Enable(True)
self.Bind(wx.EVT_RADIOBUTTON, _ChooseAuthorGlobal,
id=self.author_global_id)
def _ChooseAuthorPerEntry(event2):
author_name_box.Enable(False)
self.Bind(wx.EVT_RADIOBUTTON, _ChooseAuthorPerEntry,
id=self.author_per_entry_id)
# Set the controls to the current settings
author_name = self.entries.get_author_name()
if author_name is None:
author_name_box.SetValue("")
else:
author_name_box.SetValue(author_name)
if (self.entries.get_author_global()):
author_name_box.Enable(True)
author_global_radio.SetValue(True)
else:
author_name_box.Enable(False)
author_per_entry_radio.SetValue(True)
if (self.diary_options_dialog.ShowModal() == wx.ID_OK):
# Save the settings if OK pressed
if (author_name_box.GetValue() == ""):
self.entries.set_author_name(None)
else:
self.entries.set_author_name(author_name_box.GetValue())
self.entries.set_author_global(author_global_radio.GetValue())
self._UpdateAuthorBox() # Show/Hide the author box as needed
self._SetDiaryModified(True)
示例6: SendSelectorEvent
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def SendSelectorEvent(self, box):
if (isinstance(box, wx.CheckBox)):
# I have the feeling that this is the wrong way to trigger
# an event.
newevent = wx.CommandEvent(wx.EVT_CHECKBOX.evtType[0])
newevent.SetEventObject(box)
wx.PostEvent(box, newevent)
if (isinstance(box, wx.RadioButton)):
newevent = wx.CommandEvent(wx.EVT_RADIOBUTTON.evtType[0])
newevent.SetEventObject(box)
wx.PostEvent(box, newevent)
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def __init__(self, parent, layers=None, cols=4):
wx.Window.__init__(self, parent, wx.ID_ANY)
if (layers == None):
layers = ['F.Cu', 'F.Silks','Edge.Cuts', 'F.Mask',
'B.Cu', 'B.SilkS','Cmts.User', 'B.Mask']
sizer = wx.GridSizer(cols=cols)#, hgap=5, vgap=5)
self.SetSizer(sizer)
board = pcbnew.GetBoard()
self.layertable = {}
numlayers = pcbnew.PCB_LAYER_ID_COUNT
for i in range(numlayers):
self.layertable[board.GetLayerName(i)] = i
for layername in layers:
if (layername not in self.layertable):
ValueError("layer {} doesn't exist".format(layername))
if (layername == layers[0]):
rb = wx.RadioButton(self, label=layername, style=wx.RB_GROUP)
self.value = layername
self.valueint = self.layertable[layername]
else:
rb = wx.RadioButton(self, label=layername)
rb.Bind(wx.EVT_RADIOBUTTON, self.OnButton)
sizer.Add(rb)
示例8: _bind
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [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)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def __init__(self, colors_dict, parent=None):
wx.Dialog.__init__(self, parent, -1, "")
self.colors_dict = colors_dict
choices = list( self.colors_dict.keys() )
choices.sort()
self.panel_1 = wx.Panel(self, -1)
self.use_null_color = wx.RadioButton( self.panel_1, -1, "wxNullColour", style=wx.RB_GROUP )
self.use_sys_color = wx.RadioButton( self.panel_1, -1, _("System Color") )
self.sys_color = wx.ComboBox( self.panel_1, -1, choices=choices, style=wx.CB_DROPDOWN | wx.CB_READONLY)
self.sys_color_panel = wx.Panel(self.panel_1, -1, size=(250, 20))
self.sys_color_panel.SetBackgroundColour(wx.RED)
self.use_chooser = wx.RadioButton(self.panel_1, -1, _("Custom Color"))
self.color_chooser = PyColourChooser(self, -1)
self.ok = wx.Button(self, wx.ID_OK, _("OK"))
self.cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
self.__set_properties()
self.__do_layout()
self.use_null_color.Bind(wx.EVT_RADIOBUTTON, self.on_use_null_color)
self.use_sys_color.Bind(wx.EVT_RADIOBUTTON, self.on_use_sys_color)
self.use_chooser.Bind(wx.EVT_RADIOBUTTON, self.on_use_chooser)
self.sys_color.Bind(wx.EVT_COMBOBOX, self.display_sys_color)
self.display_sys_color()
for ctrl in (self.use_null_color, self.use_sys_color, self.use_chooser):
ctrl.Bind(wx.EVT_LEFT_DCLICK, lambda evt: self.EndModal(wx.ID_OK) )
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def __init__(
self,
parent = None,
id = -1,
label = "",
pos = (-1, -1),
size = (-1, -1),
choices = (),
majorDimension = 0,
style = wx.RA_SPECIFY_COLS,
validator = wx.DefaultValidator,
name = "radioBox"
):
self.value = 0
wx.Panel.__init__(self, parent, id, pos, size, name=name)
sizer = self.sizer = wx.GridSizer(len(choices), 1, 6, 6)
style = wx.RB_GROUP
for i, choice in enumerate(choices):
radioButton = wx.RadioButton(self, i, choice, style=style)
style = 0
self.sizer.Add(radioButton, 0, wx.EXPAND)
radioButton.Bind(wx.EVT_RADIOBUTTON, self.OnSelect)
self.SetSizer(sizer)
self.SetAutoLayout(True)
sizer.Fit(self)
self.Layout()
self.SetMinSize(self.GetSize())
self.Bind(wx.EVT_SIZE, self.OnSize)
示例11: FinishSetup
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [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)
示例12: _create_custom_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def _create_custom_layout(self):
"""Decorates the GUI with buttons for assigning class labels"""
# create horizontal layout with train/test buttons
pnl1 = wx.Panel(self, -1)
self.training = wx.RadioButton(pnl1, -1, 'Train', (10, 10),
style=wx.RB_GROUP)
self.Bind(wx.EVT_RADIOBUTTON, self._on_training, self.training)
self.testing = wx.RadioButton(pnl1, -1, 'Test')
self.Bind(wx.EVT_RADIOBUTTON, self._on_testing, self.testing)
hbox1 = wx.BoxSizer(wx.HORIZONTAL)
hbox1.Add(self.training, 1)
hbox1.Add(self.testing, 1)
pnl1.SetSizer(hbox1)
# create a horizontal layout with all buttons
pnl2 = wx.Panel(self, -1)
self.neutral = wx.RadioButton(pnl2, -1, 'neutral', (10, 10),
style=wx.RB_GROUP)
self.happy = wx.RadioButton(pnl2, -1, 'happy')
self.sad = wx.RadioButton(pnl2, -1, 'sad')
self.surprised = wx.RadioButton(pnl2, -1, 'surprised')
self.angry = wx.RadioButton(pnl2, -1, 'angry')
self.disgusted = wx.RadioButton(pnl2, -1, 'disgusted')
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
hbox2.Add(self.neutral, 1)
hbox2.Add(self.happy, 1)
hbox2.Add(self.sad, 1)
hbox2.Add(self.surprised, 1)
hbox2.Add(self.angry, 1)
hbox2.Add(self.disgusted, 1)
pnl2.SetSizer(hbox2)
# create horizontal layout with single snapshot button
pnl3 = wx.Panel(self, -1)
self.snapshot = wx.Button(pnl3, -1, 'Take Snapshot')
self.Bind(wx.EVT_BUTTON, self._on_snapshot, self.snapshot)
hbox3 = wx.BoxSizer(wx.HORIZONTAL)
hbox3.Add(self.snapshot, 1)
pnl3.SetSizer(hbox3)
# arrange all horizontal layouts vertically
self.panels_vertical.Add(pnl1, flag=wx.EXPAND | wx.TOP, border=1)
self.panels_vertical.Add(pnl2, flag=wx.EXPAND | wx.BOTTOM, border=1)
self.panels_vertical.Add(pnl3, flag=wx.EXPAND | wx.BOTTOM, border=1)
示例13: Configure
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [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,
)
#===============================================================================
示例14: Configure
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def Configure(self, count=None, timeout=1.0):
text = self.text
panel = eg.ConfigPanel()
if count is None:
count = 1
flag = False
else:
flag = True
if timeout is None:
timeout = 1.0
rb1 = panel.RadioButton(not flag, text.read_all, style=wx.RB_GROUP)
rb2 = panel.RadioButton(flag, text.read_some)
countCtrl = panel.SpinIntCtrl(count, 1, 1024)
countCtrl.Enable(flag)
timeCtrl = panel.SpinIntCtrl(int(timeout * 1000), 0, 10000)
timeCtrl.Enable(flag)
def OnRadioButton(event):
flag = rb2.GetValue()
countCtrl.Enable(flag)
timeCtrl.Enable(flag)
event.Skip()
rb1.Bind(wx.EVT_RADIOBUTTON, OnRadioButton)
rb2.Bind(wx.EVT_RADIOBUTTON, OnRadioButton)
Add = panel.sizer.Add
Add(rb1)
Add((5,5))
Add(rb2)
Add((5,5))
Add(countCtrl, 0, wx.LEFT, 25)
Add((5,5))
Add(panel.StaticText(text.read_time), 0, wx.LEFT, 25)
Add((5,5))
Add(timeCtrl, 0, wx.LEFT, 25)
while panel.Affirmed():
if rb1.GetValue():
panel.SetResult(None, 0.0)
else:
panel.SetResult(
countCtrl.GetValue(),
timeCtrl.GetValue() / 1000.0
)
示例15: Configure
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_RADIOBUTTON [as 别名]
def Configure(self, value="60", unit = 0, pos = 0, dir = 0):
text = self.text
panel = eg.ConfigPanel()
mySizer = panel.sizer
width = 120
staticText = panel.StaticText(text.label)
textCtrl = panel.TextCtrl(value, size = (2*width+10,-1))
unitSizer = wx.StaticBoxSizer(
wx.StaticBox(panel, -1, text.unit),
wx.HORIZONTAL
)
rb1 = panel.RadioButton(not unit, text.unitChoice[0], style=wx.RB_GROUP, size = (width,-1))
rb2 = panel.RadioButton(unit, text.unitChoice[1])
unitSizer.Add(rb1, 1)
unitSizer.Add(rb2, 1)
posSizer = wx.StaticBoxSizer(
wx.StaticBox(panel, -1, text.pos),
wx.HORIZONTAL
)
rb3 = panel.RadioButton(not pos, text.posChoice[0], style=wx.RB_GROUP, size = (width,-1))
rb4 = panel.RadioButton(pos, text.posChoice[1])
posSizer.Add(rb3, 1)
posSizer.Add(rb4, 1)
dirSizer = wx.StaticBoxSizer(
wx.StaticBox(panel, -1, text.dir),
wx.HORIZONTAL
)
rb5 = panel.RadioButton(not dir, text.dirChoice[0], style=wx.RB_GROUP, size = (width,-1))
rb6 = panel.RadioButton(dir, text.dirChoice[1])
dirSizer.Add(rb5, 1)
dirSizer.Add(rb6, 1)
def OnRadioButton(event=None):
flag = rb3.GetValue()
mySizer.Show(dirSizer,flag,True)
mySizer.Layout()
if event:
event.Skip()
rb3.Bind(wx.EVT_RADIOBUTTON, OnRadioButton)
rb4.Bind(wx.EVT_RADIOBUTTON, OnRadioButton)
mySizer.Add(staticText, 0, wx.TOP, 5)
mySizer.Add(textCtrl, 0, wx.TOP, 2)
mySizer.Add(unitSizer, 0, wx.TOP, 15)
mySizer.Add(posSizer, 0, wx.TOP, 15)
mySizer.Add(dirSizer, 0, wx.TOP, 15)
OnRadioButton()
while panel.Affirmed():
panel.SetResult(
textCtrl.GetValue(),
rb2.GetValue(),
rb4.GetValue(),
rb6.GetValue(),
)