Python wx.RadioButton() Examples

The following are 23 code examples of wx.RadioButton(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: radio_box.py    From wxGlade with MIT License 6 votes vote down vote up
def __init__(self, name, parent, index, style, label, choices, major_dim):
        "Class to handle wxRadioBox objects"
        ManagedBase.__init__(self, name, parent, index)
        self.static_box = None
        
        # initialise instance properties
        self.label     = np.TextProperty("", multiline="grow")
        self.dimension = np.SpinProperty(major_dim)
        self.selection = np.SpinProperty(0, val_range=(0,len(choices)-1), immediate=True )
        self.choices   = ChoicesProperty( choices, [(_('Label'), np.GridProperty.STRING)] )
        style = style or wx.RA_SPECIFY_ROWS
        styles = [wx.RA_SPECIFY_ROWS, wx.RA_SPECIFY_COLS]
        aliases = ["wxRA_SPECIFY_ROWS","wxRA_SPECIFY_COLS"]  # labels and aliases
        self.style = np.RadioProperty(style, styles, aliases, aliases=aliases, columns=2)

        self.buttons = None  # list of wx.RadioButton

    # widget creation / updates ######################################################################################## 
Example #2
Source File: DialogUtils.py    From kicad_mmccoo with Apache License 2.0 6 votes vote down vote up
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) 
Example #3
Source File: GUI_wxPython.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 5 votes vote down vote up
def addRadioButtons(self):         
        boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
        boxSizerH.Add((2, 0))
        boxSizerH.Add(wx.RadioButton(self.panel, -1, 'Blue', style=wx.RB_GROUP))
        boxSizerH.Add((33, 0)) 
        boxSizerH.Add(wx.RadioButton(self.panel, -1, 'Gold'))
        boxSizerH.Add((45, 0)) 
        boxSizerH.Add(wx.RadioButton(self.panel, -1, 'Red' ))        
        self.statBoxSizerV.Add(boxSizerH, 0, wx.ALL, 8)                  

    #---------------------------------------------------------- 
Example #4
Source File: ControlProviderMixin.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def RadioButton(self, value, label="", *args, **kwargs):
        ctrl = wx.RadioButton(self, -1, label, *args, **kwargs)
        ctrl.SetValue(value)
        return ctrl 
Example #5
Source File: RadioBox.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #6
Source File: wx_mpl_dynamic_graph.py    From code-for-blog with The Unlicense 5 votes vote down vote up
def __init__(self, parent, ID, label, initval):
        wx.Panel.__init__(self, parent, ID)
        
        self.value = initval
        
        box = wx.StaticBox(self, -1, label)
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        
        self.radio_auto = wx.RadioButton(self, -1, 
            label="Auto", style=wx.RB_GROUP)
        self.radio_manual = wx.RadioButton(self, -1,
            label="Manual")
        self.manual_text = wx.TextCtrl(self, -1, 
            size=(35,-1),
            value=str(initval),
            style=wx.TE_PROCESS_ENTER)
        
        self.Bind(wx.EVT_UPDATE_UI, self.on_update_manual_text, self.manual_text)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_text_enter, self.manual_text)
        
        manual_box = wx.BoxSizer(wx.HORIZONTAL)
        manual_box.Add(self.radio_manual, flag=wx.ALIGN_CENTER_VERTICAL)
        manual_box.Add(self.manual_text, flag=wx.ALIGN_CENTER_VERTICAL)
        
        sizer.Add(self.radio_auto, 0, wx.ALL, 10)
        sizer.Add(manual_box, 0, wx.ALL, 10)
        
        self.SetSizer(sizer)
        sizer.Fit(self) 
Example #7
Source File: color_dialog.py    From wxGlade with MIT License 5 votes vote down vote up
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) ) 
Example #8
Source File: controlcontainer.py    From admin4 with Apache License 2.0 5 votes vote down vote up
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) 
Example #9
Source File: params.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def __init__(self, parent, id, choices,
                 pos=wx.DefaultPosition, name='radiobox'):
        PPanel.__init__(self, parent, name)
        self.choices = choices
        topSizer = wx.BoxSizer()
        for i in choices:
            button = wx.RadioButton(self, -1, i, size=(-1,buttonSize[1]), name=i)
            topSizer.Add(button, 0, wx.RIGHT, 5)
            wx.EVT_RADIOBUTTON(self, button.GetId(), self.OnRadioChoice)
        self.SetAutoLayout(True)
        self.SetSizerAndFit(topSizer) 
Example #10
Source File: DialogUtils.py    From kicad_mmccoo with Apache License 2.0 5 votes vote down vote up
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) 
Example #11
Source File: DialogUtils.py    From kicad_mmccoo with Apache License 2.0 5 votes vote down vote up
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) 
Example #12
Source File: DialogUtils.py    From kicad_mmccoo with Apache License 2.0 5 votes vote down vote up
def Add(self, w):
        w.Reparent(self.scrolled)
        self.scrollsizer.Add(w)
        if (isinstance(w, wx.CheckBox) or isinstance(w, wx.RadioButton)):
            self.boxes.append(w) 
Example #13
Source File: radio_group.py    From Gooey with MIT License 5 votes vote down vote up
def createRadioButtons(self):
        # button groups in wx are statefully determined via a style flag
        # on the first button (what???). All button instances are part of the
        # same group until a new button is created with the style flag RG_GROUP
        # https://wxpython.org/Phoenix/docs/html/wx.RadioButton.html
        # (What???)
        firstButton = wx.RadioButton(self, style=wx.RB_GROUP)
        firstButton.SetValue(False)
        buttons = [firstButton]

        for _ in getin(self.widgetInfo, ['data','widgets'], [])[1:]:
            buttons.append(wx.RadioButton(self))
        return buttons 
Example #14
Source File: GUI_wxPython.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def addRadioButtons(self):         
        boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
        boxSizerH.Add((2, 0))
        boxSizerH.Add(wx.RadioButton(self.panel, -1, 'Blue', style=wx.RB_GROUP))
        boxSizerH.Add((33, 0)) 
        boxSizerH.Add(wx.RadioButton(self.panel, -1, 'Gold'))
        boxSizerH.Add((45, 0)) 
        boxSizerH.Add(wx.RadioButton(self.panel, -1, 'Red' ))        
        self.statBoxSizerV.Add(boxSizerH, 0, wx.ALL, 8)                  

    #---------------------------------------------------------- 
Example #15
Source File: components2.py    From pyFileFixity with MIT License 5 votes vote down vote up
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 
Example #16
Source File: components.py    From pyFileFixity with MIT License 5 votes vote down vote up
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 
Example #17
Source File: components.py    From me-ica with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 
Example #18
Source File: chapter7.py    From opencv-python-blueprints with GNU General Public License v3.0 4 votes vote down vote up
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) 
Example #19
Source File: newHeadOfAccount.py    From HH---POS-Accounting-and-ERP-Software with MIT License 4 votes vote down vote up
def __init__(self, parent):
		
		wx.Dialog.__init__(self, parent, wx.ID_ANY, "New Head of Account", size= (650,400))
		self.panel = wx.Panel(self,wx.ID_ANY)
		
		self.mainSizer = wx.BoxSizer( wx.VERTICAL )
		
		self.lblName = wx.StaticText(self.panel, label="Name")
		self.name = wx.TextCtrl(self.panel, value="", size=(90,-1))
		
		self.nameSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.nameSizer.Add( self.lblName )
		self.nameSizer.Add( self.name )
		self.mainSizer.Add( self.nameSizer )
		
		self.assetRadio = wx.RadioButton(self.panel, wx.ID_ANY, label="Asset", style=0, name="asset")
		self.liabilityRadio = wx.RadioButton(self.panel, wx.ID_ANY, label="Liability", style=0, name="liability")
		
		self.radioSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.radioSizer.Add( self.assetRadio )
		self.radioSizer.Add( self.liabilityRadio )
		self.mainSizer.Add( self.radioSizer )
		
		self.saveButton = wx.Button(self.panel, label="Save")
		self.closeButton = wx.Button(self.panel, label="Cancel")
		
		self.buttonSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.buttonSizer.Add( self.saveButton )
		self.buttonSizer.Add( self.closeButton )
		self.mainSizer.Add( self.buttonSizer )
		
		self.SetSizer( self.mainSizer )
		self.Layout()
		self.mainSizer.Fit(self.panel)
		self.Centre( wx.BOTH )
		
		self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
		self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
		
		self.Bind(wx.EVT_CLOSE, self.OnQuit)
		
		self.Show() 
Example #20
Source File: newHeadOfAccount.py    From HH---POS-Accounting-and-ERP-Software with MIT License 4 votes vote down vote up
def __init__(self, parent):
		
		wx.Dialog.__init__(self, parent, wx.ID_ANY, "New Head of Account", size= (650,400))
		self.panel = wx.Panel(self,wx.ID_ANY)
		
		self.mainSizer = wx.BoxSizer( wx.VERTICAL )
		
		self.lblName = wx.StaticText(self.panel, label="Name")
		self.name = wx.TextCtrl(self.panel, value="", size=(90,-1))
		
		self.nameSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.nameSizer.Add( self.lblName )
		self.nameSizer.Add( self.name )
		self.mainSizer.Add( self.nameSizer )
		
		self.assetRadio = wx.RadioButton(self.panel, wx.ID_ANY, label="Asset", style=0, name="asset")
		self.liabilityRadio = wx.RadioButton(self.panel, wx.ID_ANY, label="Liability", style=0, name="liability")
		
		self.radioSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.radioSizer.Add( self.assetRadio )
		self.radioSizer.Add( self.liabilityRadio )
		self.mainSizer.Add( self.radioSizer )
		
		self.saveButton = wx.Button(self.panel, label="Save")
		self.closeButton = wx.Button(self.panel, label="Cancel")
		
		self.buttonSizer = wx.BoxSizer( wx.HORIZONTAL )
		self.buttonSizer.Add( self.saveButton )
		self.buttonSizer.Add( self.closeButton )
		self.mainSizer.Add( self.buttonSizer )
		
		self.SetSizer( self.mainSizer )
		self.Layout()
		self.mainSizer.Fit(self.panel)
		self.Centre( wx.BOTH )
		
		self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
		self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
		
		self.Bind(wx.EVT_CLOSE, self.OnQuit)
		
		self.Show() 
Example #21
Source File: statink.py    From IkaLog with Apache License 2.0 4 votes vote down vote up
def on_option_tab_create(self, notebook):
        self.panel = wx.Panel(notebook, wx.ID_ANY)
        self.panel_name = _('stat.ink')
        self.layout = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.layout)
        self.checkEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Post game results to stat.ink'))
        self.editApiKey = wx.TextCtrl(self.panel, wx.ID_ANY, u'API key')
        self.button_statink = wx.Button(
            self.panel, wx.ID_ANY, _('Confirm API key'))
        self.button_statink.Bind(wx.EVT_BUTTON, self.on_click_button_statink)

        self.checkShowResponseEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Show stat.ink response in console'))
        self.checkTrackSpecialGaugeEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Include Special gauge (experimental)'))
        self.checkTrackSpecialWeaponEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Include Special Weapons (experimental)'))
        self.checkTrackObjectiveEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Include position data of tracked objectives (experimental)'))
        self.checkTrackSplatzoneEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Include Splat Zone counters (experimental)'))
        self.checkTrackInklingStateEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Include inkling status (experimental)'))

        self.radio_anon_disable = wx.RadioButton(
            self.panel, wx.ID_ANY, _('Disabled'))
        self.radio_anon_others = wx.RadioButton(
            self.panel, wx.ID_ANY, _('Other players'))
        self.radio_anon_all = wx.RadioButton(
            self.panel, wx.ID_ANY, _('All players'))

        self.layout.Add(self.checkEnable)
        self.api_key_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.api_key_sizer.Add(wx.StaticText(
            self.panel, wx.ID_ANY, _('API Key')))
        self.api_key_sizer.Add(self.editApiKey, -1, flag=wx.EXPAND)
        self.api_key_sizer.Add(self.button_statink)
        self.layout.Add(self.api_key_sizer, flag=wx.EXPAND)
        self.layout.Add((20, 20))
        self.layout.Add(self.checkShowResponseEnable)
        self.layout.Add(self.checkTrackInklingStateEnable)
        self.layout.Add(self.checkTrackSpecialGaugeEnable)
        self.layout.Add(self.checkTrackSpecialWeaponEnable)
        self.layout.Add(self.checkTrackObjectiveEnable)
        self.layout.Add(self.checkTrackSplatzoneEnable)
        self.layout.Add(wx.StaticText(self.panel, wx.ID_ANY, _('Anonymizer (Hide player names)')))
        self.layout.Add(self.radio_anon_disable)
        self.layout.Add(self.radio_anon_others)
        self.layout.Add(self.radio_anon_all)

        self.panel.SetSizer(self.layout)

    # wx event 
Example #22
Source File: LDPowerRailDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent, controller, tagname):
        """
        Constructor
        @param parent: Parent wx.Window of dialog for modal
        @param controller: Reference to project controller
        @param tagname: Tagname of project POU edited
        """
        BlockPreviewDialog.__init__(self, parent, controller, tagname,
                                    title=_('Power Rail Properties'))

        # Init common sizers
        self._init_sizers(2, 0, 5, None, 2, 1)

        # Create label for connection type
        type_label = wx.StaticText(self, label=_('Type:'))
        self.LeftGridSizer.AddWindow(type_label, flag=wx.GROW)

        # Create radio buttons for selecting power rail type
        self.TypeRadioButtons = {}
        first = True
        for type, label in [(LEFTRAIL, _('Left PowerRail')),
                            (RIGHTRAIL, _('Right PowerRail'))]:
            radio_button = wx.RadioButton(self, label=label,
                                          style=(wx.RB_GROUP if first else 0))
            radio_button.SetValue(first)
            self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
            self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
            self.TypeRadioButtons[type] = radio_button
            first = False

        # Create label for power rail pin number
        pin_number_label = wx.StaticText(self, label=_('Pin number:'))
        self.LeftGridSizer.AddWindow(pin_number_label, flag=wx.GROW)

        # Create spin control for defining power rail pin number
        self.PinNumber = wx.SpinCtrl(self, min=1, max=50,
                                     style=wx.SP_ARROW_KEYS)
        self.PinNumber.SetValue(1)
        self.Bind(wx.EVT_SPINCTRL, self.OnPinNumberChanged, self.PinNumber)
        self.LeftGridSizer.AddWindow(self.PinNumber, flag=wx.GROW)

        # Add preview panel and associated label to sizers
        self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
        self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)

        # Add buttons sizer to sizers
        self.MainSizer.AddSizer(
            self.ButtonSizer, border=20,
            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
        self.Fit()

        # Left Power Rail radio button is default control having keyboard focus
        self.TypeRadioButtons[LEFTRAIL].SetFocus() 
Example #23
Source File: viewer_low_level_util.py    From dials with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def __init__(self, outer_panel):
        super(buttons_panel, self).__init__(outer_panel)
        self.parent_panel = outer_panel

        Show_Its_CheckBox = wx.CheckBox(self, -1, "Show I nums")
        Show_Its_CheckBox.SetValue(True)
        Show_Its_CheckBox.Bind(wx.EVT_CHECKBOX, self.OnItsCheckbox)

        self.my_sizer = wx.BoxSizer(wx.VERTICAL)
        self.my_sizer.Add(Show_Its_CheckBox, proportion=0, flag=wx.ALIGN_TOP, border=5)

        if self.parent_panel.segn_lst_in is not None:
            Show_Msk_CheckBox = wx.CheckBox(self, -1, "Show Mask")
            Show_Msk_CheckBox.SetValue(True)
            Show_Msk_CheckBox.Bind(wx.EVT_CHECKBOX, self.OnMskCheckbox)

            self.my_sizer.Add(
                Show_Msk_CheckBox, proportion=0, flag=wx.ALIGN_TOP, border=5
            )

            masck_conv_str = "\n Mask Convention:"
            masck_conv_str += "\n [Valid]                      =  \\\\\\\\\\\\  "
            masck_conv_str += "\n [Foreground]           =  //////  "
            masck_conv_str += "\n [Background]          =  ||||||  "
            masck_conv_str += "\n [BackgroundUsed]  =  ------"

            label_mask = wx.StaticText(self, -1, masck_conv_str)
            self.my_sizer.Add(label_mask, proportion=0, flag=wx.ALIGN_TOP, border=5)

        label_palette = wx.StaticText(self, -1, "\nColour Palettes")

        self.RadButtb2w = wx.RadioButton(self, -1, "black2white")
        self.RadButtw2b = wx.RadioButton(self, -1, "white2black")
        self.RadButtha = wx.RadioButton(self, -1, "hot ascend")
        self.RadButthd = wx.RadioButton(self, -1, "hot descend")

        self.RadButtb2w.Bind(wx.EVT_RADIOBUTTON, self.OnButtb2w)
        self.RadButtw2b.Bind(wx.EVT_RADIOBUTTON, self.OnButtw2b)
        self.RadButtha.Bind(wx.EVT_RADIOBUTTON, self.OnButtha)
        self.RadButthd.Bind(wx.EVT_RADIOBUTTON, self.OnButthd)

        self.my_sizer.Add(label_palette, proportion=0, flag=wx.ALIGN_TOP, border=5)

        self.my_sizer.Add(self.RadButtb2w, proportion=0, flag=wx.ALIGN_TOP, border=5)
        self.my_sizer.Add(self.RadButtw2b, proportion=0, flag=wx.ALIGN_TOP, border=5)
        self.my_sizer.Add(self.RadButtha, proportion=0, flag=wx.ALIGN_TOP, border=5)
        self.my_sizer.Add(self.RadButthd, proportion=0, flag=wx.ALIGN_TOP, border=5)

        self.my_sizer.SetMinSize((50, 300))
        self.SetSizer(self.my_sizer)