本文整理汇总了Python中wx.EVT_CHECKBOX属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_CHECKBOX属性的具体用法?Python wx.EVT_CHECKBOX怎么用?Python wx.EVT_CHECKBOX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_CHECKBOX属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_summary_widgets
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def get_summary_widgets(self, summary_panel):
"""Return a list of summary widgets suitable for sizer.AddMany."""
self.summary_panel = summary_panel
self.summary_name = wx.StaticText(summary_panel, -1, self.name)
self.summary_name.Bind(wx.EVT_LEFT_UP, self.show_this_panel)
self.summary_status = wx.StaticText(summary_panel, -1, STR_STOPPED)
self.summary_shares_accepted = wx.StaticText(summary_panel, -1, "0")
self.summary_shares_invalid = wx.StaticText(summary_panel, -1, "0")
self.summary_start = wx.Button(summary_panel, -1, self.get_start_stop_state(), style=wx.BU_EXACTFIT)
self.summary_start.Bind(wx.EVT_BUTTON, self.toggle_mining)
self.summary_autostart = wx.CheckBox(summary_panel, -1)
self.summary_autostart.Bind(wx.EVT_CHECKBOX, self.toggle_autostart)
self.summary_autostart.SetValue(self.autostart)
return [
(self.summary_name, 0, wx.ALIGN_CENTER_HORIZONTAL),
(self.summary_status, 0, wx.ALIGN_CENTER_HORIZONTAL, 0),
(self.summary_shares_accepted, 0, wx.ALIGN_CENTER_HORIZONTAL, 0),
(self.summary_shares_invalid, 0, wx.ALIGN_CENTER_HORIZONTAL, 0),
(self.summary_start, 0, wx.ALIGN_CENTER, 0),
(self.summary_autostart, 0, wx.ALIGN_CENTER, 0)
]
示例2: BindModelProperties
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def BindModelProperties(self):
self.btnCalibrateTilt.Bind(wx.EVT_BUTTON, self.scaniface.Calibrate)
self.btnCalibrateExtent.Bind(wx.EVT_BUTTON, self.scaniface.CalibrateModelBBox)
# model parameters
self.elevInput.Bind(wx.EVT_TEXT, self.OnModelProperties)
self.regionInput.Bind(wx.EVT_TEXT, self.OnModelProperties)
self.zexag.Bind(wx.EVT_TEXT, self.OnModelProperties)
self.rotate.Bind(wx.EVT_SPINCTRL, self.OnModelProperties)
self.rotate.Bind(wx.EVT_TEXT, self.OnModelProperties)
self.numscans.Bind(wx.EVT_SPINCTRL, self.OnModelProperties)
self.numscans.Bind(wx.EVT_TEXT, self.OnModelProperties)
self.interpolate.Bind(wx.EVT_CHECKBOX, self.OnModelProperties)
self.smooth.Bind(wx.EVT_TEXT, self.OnModelProperties)
self.resolution.Bind(wx.EVT_TEXT, self.OnModelProperties)
self.trim_tolerance.Bind(wx.EVT_TEXT, self.OnModelProperties)
for each in 'nsewtb':
self.trim[each].Bind(wx.EVT_TEXT, self.OnModelProperties)
示例3: AddSelector
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [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)
示例4: create_editor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def create_editor(self, panel, sizer):
label_text = self._find_label()
self.checkbox = wx.CheckBox(panel, -1, '', name=label_text)
self._display_value()
self.label_ctrl = label = self._get_label(label_text, panel, name=label_text)
if config.preferences.use_checkboxes_workaround:
size = self.checkbox.GetSize()
self.checkbox.SetLabel(label_text)
self.checkbox.SetMaxSize(size)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
#hsizer.Add(label, 2, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3)
hsizer.Add(label, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 3)
#hsizer.SetItemMinSize(0, config.label_initial_width, -1)
#hsizer.AddSpacer(20)
hsizer.Add(self.checkbox, 0, wx.ALIGN_LEFT | wx.ALL, 3)
hsizer.AddStretchSpacer(5)
sizer.Add(hsizer, 0, wx.EXPAND)
self._set_tooltip(label, self.checkbox)
self.checkbox.Bind(wx.EVT_CHECKBOX, self.on_change_val)
self.editing = True
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def __init__(self, canvas, legend):
NavigationToolbar2Wx.__init__(self, canvas)
self._canvas = canvas
self._legend = legend
self._autoScale = True
if matplotlib.__version__ >= '1.2':
panId = self.wx_ids['Pan']
else:
panId = self.FindById(self._NTB2_PAN).GetId()
self.ToggleTool(panId, True)
self.pan()
checkLegend = wx.CheckBox(self, label='Legend')
checkLegend.SetValue(legend.get_visible())
self.AddControl(checkLegend)
self.Bind(wx.EVT_CHECKBOX, self.__on_legend, checkLegend, id)
if wx.__version__ >= '2.9.1':
self.AddStretchableSpace()
else:
self.AddSeparator()
self._textCursor = wx.StaticText(self, style=wx.ALL | wx.ALIGN_RIGHT)
font = self._textCursor.GetFont()
if wx.__version__ >= '2.9.1':
font.MakeSmaller()
font.SetFamily(wx.FONTFAMILY_TELETYPE)
self._textCursor.SetFont(font)
w, _h = get_text_size(' ' * 18, font)
self._textCursor.SetSize((w, -1))
self.AddControl(self._textCursor)
self.Realize()
示例6: addCheckBox
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def addCheckBox(self, name, parent, sizer, pad):
cb = wx.CheckBox(parent, -1, name)
wx.EVT_CHECKBOX(self, cb.GetId(), self.OnMisc)
sizer.Add(cb, 0, wx.TOP, pad)
setattr(self, name.lower() + "Cb", cb)
示例7: addCheckBox
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def addCheckBox(self, name, prefix, parent, sizer, pad):
cb = wx.CheckBox(parent, -1, name)
wx.EVT_CHECKBOX(self, cb.GetId(), self.OnStyleCb)
sizer.Add(cb, 0, wx.TOP, pad)
setattr(self, prefix + name + "Cb", cb)
示例8: addCb
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def addCb(self, descr, sizer, pad):
ctrl = wx.CheckBox(self, -1, descr)
wx.EVT_CHECKBOX(self, ctrl.GetId(), self.OnMisc)
sizer.Add(ctrl, 0, wx.TOP, pad)
return ctrl
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def __init__(self, parent, id, title):
super().__init__(parent, id, title=title)
main_sizer = wx.BoxSizer(wx.VERTICAL)
# Translators: A checkbox in add-on options dialog to set whether remote server is started when NVDA starts.
self.autoconnect = wx.CheckBox(self, wx.ID_ANY, label=_("Auto-connect to control server on startup"))
self.autoconnect.Bind(wx.EVT_CHECKBOX, self.on_autoconnect)
main_sizer.Add(self.autoconnect)
#Translators: Whether or not to use a relay server when autoconnecting
self.client_or_server = wx.RadioBox(self, wx.ID_ANY, choices=(_("Use Remote Control Server"), _("Host Control Server")), style=wx.RA_VERTICAL)
self.client_or_server.Bind(wx.EVT_RADIOBOX, self.on_client_or_server)
self.client_or_server.SetSelection(0)
self.client_or_server.Enable(False)
main_sizer.Add(self.client_or_server)
choices = [_("Allow this machine to be controlled"), _("Control another machine")]
self.connection_type = wx.RadioBox(self, wx.ID_ANY, choices=choices, style=wx.RA_VERTICAL)
self.connection_type.SetSelection(0)
self.connection_type.Enable(False)
main_sizer.Add(self.connection_type)
main_sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Host:")))
self.host = wx.TextCtrl(self, wx.ID_ANY)
self.host.Enable(False)
main_sizer.Add(self.host)
main_sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Port:")))
self.port = wx.TextCtrl(self, wx.ID_ANY)
self.port.Enable(False)
main_sizer.Add(self.port)
main_sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Key:")))
self.key = wx.TextCtrl(self, wx.ID_ANY)
self.key.Enable(False)
main_sizer.Add(self.key)
buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
main_sizer.Add(buttons, flag=wx.BOTTOM)
main_sizer.Fit(self)
self.SetSizer(main_sizer)
self.Center(wx.BOTH | WX_CENTER)
ok = wx.FindWindowById(wx.ID_OK, self)
ok.Bind(wx.EVT_BUTTON, self.on_ok)
self.autoconnect.SetFocus()
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def __init__(self, parent, sync_model):
wx.Panel.__init__(self, parent, style=wx.RAISED_BORDER)
headerFont = wx.Font(11.5, wx.SWISS, wx.NORMAL, wx.NORMAL)
self.sync_model = sync_model
self.dstc = GoSyncDriveTree(self, pos=(0,0))
self.t1 = wx.StaticText(self, -1, "Choose the directories to sync:", pos=(0,0))
self.t1.SetFont(headerFont)
self.cb = wx.CheckBox(self, -1, 'Sync Everything', (10, 10))
self.cb.SetValue(True)
self.cb.Disable()
self.dstc.Disable()
self.cb.Bind(wx.EVT_CHECKBOX, self.SyncSetting)
self.Bind(CT.EVT_TREE_ITEM_CHECKED, self.ItemChecked)
GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_DONE,
self.RefreshTree)
GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_STARTED,
self.OnUsageCalculationStarted)
self.cb.Bind(wx.EVT_CHECKBOX, self.SyncSetting)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.t1, 0, wx.ALL)
sizer.Add(self.cb, 0, wx.ALL)
sizer.Add(self.dstc, 1, wx.EXPAND,2)
self.SetSizer(sizer)
示例11: create_sizer_diaginch_override
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def create_sizer_diaginch_override(self):
self.sizer_setting_diaginch.Clear(True)
# statbox_parent_diaginch = self.sizer_setting_diaginch.GetStaticBox()
statbox_parent_diaginch = self
self.cb_diaginch = wx.CheckBox(statbox_parent_diaginch, -1, "Input display sizes manually")
self.cb_diaginch.Bind(wx.EVT_CHECKBOX, self.onCheckboxDiaginch)
st_diaginch = wx.StaticText(
statbox_parent_diaginch, -1,
"Display diagonal sizes (inches):"
)
st_diaginch.Disable()
self.sizer_setting_diaginch.Add(self.cb_diaginch, 0, wx.ALIGN_LEFT|wx.LEFT, 0)
self.sizer_setting_diaginch.Add(st_diaginch, 0, wx.ALIGN_LEFT|wx.LEFT, 10)
# diag size data for fields
diags = [str(dsp.diagonal_size()[1]) for dsp in self.display_sys.disp_list]
# sizer for textctrls
tc_list_sizer_diag = wx.WrapSizer(wx.HORIZONTAL)
self.tc_list_diaginch = self.list_of_textctrl(statbox_parent_diaginch, wpproc.NUM_DISPLAYS, fraction=2/5)
for tc, diag in zip(self.tc_list_diaginch, diags):
tc_list_sizer_diag.Add(tc, 0, wx.ALIGN_LEFT|wx.ALL, 5)
tc.ChangeValue(diag)
tc.Disable()
self.button_diaginch_save = wx.Button(statbox_parent_diaginch, label="Save")
self.button_diaginch_save.Bind(wx.EVT_BUTTON, self.onSaveDiagInch)
tc_list_sizer_diag.Add(self.button_diaginch_save, 0, wx.ALL, 5)
self.button_diaginch_save.Disable()
self.sizer_setting_diaginch.Add(tc_list_sizer_diag, 0, wx.ALIGN_LEFT|wx.LEFT, 5)
self.sizer_setting_adv.Layout()
self.sizer_main.Layout()
self.sizer_main.Fit(self.frame)
# Check cb according to DisplaySystem 'use_user_diags'
self.cb_diaginch.SetValue(self.display_sys.use_user_diags)
# Update sizer content based on new cb state
self.onCheckboxDiaginch(None)
示例12: _bindUI
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [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)))
示例13: crt_checkbox
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def crt_checkbox(self, label, event_handler=None):
checkbox = wx.CheckBox(self, label=label, size=self.CHECKBOX_SIZE)
if event_handler is not None:
checkbox.Bind(wx.EVT_CHECKBOX, event_handler)
return checkbox
示例14: _on_shutdown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def _on_shutdown(self, event):
"""Event handler for the wx.EVT_CHECKBOX of the shutdown_checkbox."""
self.sudo_textctrl.Enable(self.shutdown_checkbox.GetValue())
示例15: _on_enable_log
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHECKBOX [as 别名]
def _on_enable_log(self, event):
"""Event handler for the wx.EVT_CHECKBOX of the enable_log_checkbox."""
wx.MessageBox(_("In order for the changes to take effect please restart {0}").format(__appname__),
_("Restart"),
wx.OK | wx.ICON_INFORMATION,
self)