Python wx.CheckBox() Examples

The following are 30 code examples of wx.CheckBox(). 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: new_properties.py    From wxGlade with MIT License 6 votes vote down vote up
def create_editor(self, panel, sizer):
        self._choices = []
        tooltips = self._create_tooltip_text()
        for box_label in self.styles.keys():
            static_box = wx.StaticBox(panel, -1, box_label, style=wx.FULL_REPAINT_ON_RESIZE)
            box_sizer = wx.StaticBoxSizer(static_box, wx.VERTICAL)
            for style in self.styles[box_label]:
                checkbox = wx.CheckBox(panel, -1, style)

                if style in tooltips: compat.SetToolTip(checkbox, tooltips[style])
                self._choices.append(checkbox)
                box_sizer.Add(checkbox)

            sizer.Add(box_sizer, 0, wx.ALL | wx.EXPAND, 5)

        self.update_display(True)
        for checkbox in self._choices:
            if checkbox is None: continue  # derived classes may not use all options, e.g. obsolete ones
            checkbox.Bind(wx.EVT_CHECKBOX, self.on_checkbox) 
Example #2
Source File: GUI_wxPython.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
def addCheckBoxes(self):
        # Regular Box Sizer 
        boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
        chk1 = wx.CheckBox(self.panel, label='Disabled')
        chk1.SetValue(True)
        chk1.Disable()
        boxSizerH.Add(chk1)
        chk2 = wx.CheckBox(self.panel, label='UnChecked')
        boxSizerH.Add(chk2, flag=wx.LEFT, border=10)
        chk3 = wx.CheckBox(self.panel, label='Toggle')
        boxSizerH.Add(chk3, flag=wx.LEFT, border=10)
        chk3.SetValue(True)
        # Add Regular Box Sizer to StaticBox sizer
        self.statBoxSizerV.Add(boxSizerH, flag=wx.LEFT, border=10)
        self.statBoxSizerV.Add((0, 8))     
          
    #---------------------------------------------------------- 
Example #3
Source File: flagpage.py    From magpy with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def createControls(self):
        self.flagOptionsLabel = wx.StaticText(self, label="Flagging methods:")
        self.flagOutlierButton = wx.Button(self,-1,"Flag Outlier",size=(160,30))
        self.flagRangeButton = wx.Button(self,-1,"Flag Range",size=(160,30))
        self.flagMinButton = wx.Button(self,-1,"Flag Minimum",size=(160,30))
        self.flagMaxButton = wx.Button(self,-1,"Flag Maximum",size=(160,30))
        self.xCheckBox = wx.CheckBox(self,label="X             ")
        self.yCheckBox = wx.CheckBox(self,label="Y             ")
        self.zCheckBox = wx.CheckBox(self,label="Z             ")
        self.fCheckBox = wx.CheckBox(self,label="F             ")
        self.FlagIDText = wx.StaticText(self,label="Select Min/Max Flag ID:")
        self.FlagIDComboBox = wx.ComboBox(self, choices=self.flagidlist,
            style=wx.CB_DROPDOWN, value=self.flagidlist[3],size=(160,-1))
        self.flagSelectionButton = wx.Button(self,-1,"Flag Selection",size=(160,30))
        self.flagDropButton = wx.Button(self,-1,"Drop flagged",size=(160,30))
        self.flagLoadButton = wx.Button(self,-1,"Load flags",size=(160,30))
        self.flagSaveButton = wx.Button(self,-1,"Save flags",size=(160,30))
        self.flagClearButton = wx.Button(self,-1,"Clear flags",size=(160,30)) 
Example #4
Source File: developpage.py    From magpy with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def createControls(self):
        self.DrawAuxButton = wx.Button(self,-1,"Draw/Recalc")
        self.SaveAuxButton = wx.Button(self,-1,"Save data")
        self.AppendAuxButton = wx.Button(self,-1,"Append")
        self.OpenAuxButton = wx.Button(self,-1,"Open Aux file")
        self.AuxDataLabel = wx.StaticText(self, label="Auxiliary data")
        self.AuxDataTextCtrl = wx.TextCtrl(self, style=wx.TE_MULTILINE) # get this value from obsini
        self.AuxDataTextCtrl.Disable()
        self.AuxResolutionLabel = wx.StaticText(self, label="Time resolution")
        self.AuxResolutionTextCtrl = wx.TextCtrl(self, value="NaN")
        self.AuxResolutionTextCtrl.Disable()
        self.AuxStartDateTextCtrl = wx.TextCtrl(self, value="--")
        self.AuxStartDateTextCtrl.Disable()
        self.AuxEndDateTextCtrl = wx.TextCtrl(self, value="--")
        self.AuxEndDateTextCtrl.Disable()
        self.funcLabel = wx.StaticText(self, label="Apply fuctions:")
        self.removeOutliersCheckBox = wx.CheckBox(self,
            label="Remove Outliers")
        self.recoveryCheckBox = wx.CheckBox(self,
            label="Show data coverage")
        self.interpolateCheckBox = wx.CheckBox(self,
            label="Interpolate data")
        self.fitCheckBox = wx.CheckBox(self,
            label="Fit function") 
Example #5
Source File: websocket_server.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
def on_option_tab_create(self, notebook):
        self.panel = wx.Panel(notebook, wx.ID_ANY)
        self.panel_name = _('WebSocket Server')
        self.layout = wx.BoxSizer(wx.VERTICAL)

        self.check_enable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Enable WebSocket Server'))
        self.edit_port = wx.TextCtrl(self.panel, wx.ID_ANY, 'port')

        layout = wx.GridSizer(2)
        layout.Add(wx.StaticText(self.panel, wx.ID_ANY, _('Listen port')))
        layout.Add(self.edit_port)

        self.layout.Add(self.check_enable)
        self.layout.Add(wx.StaticText(
            self.panel, wx.ID_ANY,
            _('WARNING: The server is accessible by anyone.'),
        ))
        self.layout.Add(layout, flag=wx.EXPAND)

        self.panel.SetSizer(self.layout) 
Example #6
Source File: hue.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
def on_option_tab_create(self, notebook):
        self.panel = wx.Panel(notebook, wx.ID_ANY, size=(640, 360))
        self.panel_name = 'Hue'
        self.layout = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.layout)
        self.checkEnable = wx.CheckBox(self.panel, wx.ID_ANY, u'Hue と連携')
        self.editHueHost = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge')
        self.editHueUsername = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge')

        try:
            layout = wx.GridSizer(2, 2)
        except:
            layout = wx.GridSizer(2)

        layout.Add(wx.StaticText(self.panel, wx.ID_ANY, u'ホスト'))
        layout.Add(self.editHueHost)
        layout.Add(wx.StaticText(self.panel, wx.ID_ANY, u'ユーザ'))
        layout.Add(self.editHueUsername)
        self.layout.Add(self.checkEnable)
        self.layout.Add(layout)

    # enhance_color and rgb2xy is imported from:
    # https://gist.githubusercontent.com/error454/6b94c46d1f7512ffe5ee/raw/73b190ce256c3d8dd540cc34e6dae43848cbce4c/gistfile1.py

    # All the rights belongs to the author. 
Example #7
Source File: csv.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
def on_option_tab_create(self, notebook):
        self.panel = wx.Panel(notebook, wx.ID_ANY)
        self.panel_name = _('CSV')
        self.layout = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.layout)
        self.checkEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Enable CSV Log'))
        self.editCsvFilename = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge')

        self.layout.Add(wx.StaticText(self.panel, wx.ID_ANY, _('Log Filename')))
        self.layout.Add(self.editCsvFilename, flag=wx.EXPAND)

        self.layout.Add(self.checkEnable)

    ##
    # Write a line to text file.
    # @param self     The Object Pointer.
    # @param record   Record (text)
    # 
Example #8
Source File: screenshot.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
def on_option_tab_create(self, notebook):
        self.panel = wx.Panel(notebook, wx.ID_ANY)
        self.panel_name = _('Screenshot')
        self.layout = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.layout)
        self.checkResultDetailEnable = wx.CheckBox(
            self.panel, wx.ID_ANY, _('Save screenshots of game results'))
        self.editDir = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge')

        self.layout.Add(wx.StaticText(
            self.panel, wx.ID_ANY, _('Folder to save screenshots')))
        self.layout.Add(self.editDir, flag=wx.EXPAND)
        self.layout.Add(self.checkResultDetailEnable)

        self.panel.SetSizer(self.layout)

    ##
    # on_result_detail_still Hook
    # @param self      The Object Pointer
    # @param context   IkaLog context
    # 
Example #9
Source File: guiminer.py    From poclbm with GNU General Public License v3.0 6 votes vote down vote up
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)
        ] 
Example #10
Source File: guiminer.py    From poclbm with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, -1, _("No OpenCL devices found."))
        vbox = wx.BoxSizer(wx.VERTICAL)
        self.message = wx.StaticText(self, -1,
 _("""No OpenCL devices were found.
 If you only want to mine using CPU or CUDA, you can ignore this message.
 If you want to mine on ATI graphics cards, you may need to install the ATI Stream
 SDK, or your GPU may not support OpenCL."""))
        vbox.Add(self.message, 0, wx.ALL, 10)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        self.no_show_chk = wx.CheckBox(self, -1)
        hbox.Add(self.no_show_chk)
        self.no_show_txt = wx.StaticText(self, -1, _("Don't show this message again"))
        hbox.Add((5, 0))
        hbox.Add(self.no_show_txt)
        vbox.Add(hbox, 0, wx.ALL, 10)
        buttons = self.CreateButtonSizer(wx.OK)
        vbox.Add(buttons, 0, wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL, 0)
        self.SetSizerAndFit(vbox) 
Example #11
Source File: components.py    From pyFileFixity with MIT License 6 votes vote down vote up
def Update(self, size):
    '''
    Custom wrapper calculator to account for the
    increased size of the _msg widget after being
    inlined with the wx.CheckBox
    '''
    if self._msg is None:
      return
    help_msg = self._msg
    width, height = size
    content_area = int((width / 3) * .70)

    wiggle_room = range(int(content_area - content_area * .05), int(content_area + content_area * .05))
    if help_msg.Size[0] not in wiggle_room:
      self._msg.SetLabel(self._msg.GetLabelText().replace('\n', ' '))
      self._msg.Wrap(content_area) 
Example #12
Source File: components.py    From pyFileFixity with MIT License 6 votes vote down vote up
def do_layout(self, parent):
    self.panel = wx.Panel(parent)

    self.widget = wx.CheckBox(self.panel)
    self.title = self.createTitle(self.panel)
    self.help_msg = self.createHelpMsgWidget(self.panel)
    self.help_msg.SetMinSize((0, -1))

    self.help_msg.Bind(wx.EVT_LEFT_UP, lambda event: self.widget.SetValue(not self.widget.GetValue()))

    vertical_container = wx.BoxSizer(wx.VERTICAL)
    vertical_container.Add(self.title)

    horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL)
    horizontal_sizer.Add(self.widget, 0, wx.EXPAND | wx.RIGHT, 10)
    horizontal_sizer.Add(self.help_msg, 1, wx.EXPAND)

    vertical_container.Add(horizontal_sizer, 0, wx.EXPAND)

    self.panel.SetSizer(vertical_container)
    self.panel.Bind(wx.EVT_SIZE, self.onResize)
    return self.panel 
Example #13
Source File: GUI_wxPython.py    From Python-GUI-Programming-Cookbook-Third-Edition with MIT License 6 votes vote down vote up
def addCheckBoxes(self):
        # Regular Box Sizer 
        boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
        chk1 = wx.CheckBox(self.panel, label='Disabled')
        chk1.SetValue(True)
        chk1.Disable()
        boxSizerH.Add(chk1)
        chk2 = wx.CheckBox(self.panel, label='UnChecked')
        boxSizerH.Add(chk2, flag=wx.LEFT, border=10)
        chk3 = wx.CheckBox(self.panel, label='Toggle')
        boxSizerH.Add(chk3, flag=wx.LEFT, border=10)
        chk3.SetValue(True)
        # Add Regular Box Sizer to StaticBox sizer
        self.statBoxSizerV.Add(boxSizerH, flag=wx.LEFT, border=10)
        self.statBoxSizerV.Add((0, 8))     
          
    #---------------------------------------------------------- 
Example #14
Source File: components.py    From me-ica with GNU Lesser General Public License v2.1 6 votes vote down vote up
def do_layout(self, parent, title, msg):
    self.panel = wx.Panel(parent)

    self.widget = wx.CheckBox(self.panel)
    # self.widget.SetValue(self.default_value)
    self.title = self.format_title(self.panel, title)
    self.help_msg = self.format_help_msg(self.panel, msg)
    self.help_msg.SetMinSize((0, -1))

    # self.help_msg.Bind(wx.EVT_LEFT_UP, lambda event: self.widget.SetValue(not self.widget.GetValue()))

    vertical_container = wx.BoxSizer(wx.VERTICAL)
    vertical_container.Add(self.title)

    horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL)
    horizontal_sizer.Add(self.widget, 0, wx.EXPAND | wx.RIGHT, 10)
    horizontal_sizer.Add(self.help_msg, 1, wx.EXPAND)

    vertical_container.Add(horizontal_sizer, 0, wx.EXPAND)

    self.panel.SetSizer(vertical_container)
    self.panel.Bind(wx.EVT_SIZE, self.onResize)
    return self.panel 
Example #15
Source File: new_properties.py    From wxGlade with MIT License 6 votes vote down vote up
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 
Example #16
Source File: font_dialog.py    From wxGlade with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_2_copy = wx.StaticText(self, -1, _("Family:"))
        self.label_3_copy = wx.StaticText(self, -1, _("Style:"))
        self.label_4_copy = wx.StaticText(self, -1, _("Weight:"))
        self.family = wx.Choice(self, -1, choices=["Default", "Decorative", "Roman", "Script", "Swiss", "Modern"])
        self.style = wx.Choice(self, -1, choices=["Normal", "Slant", "Italic"])
        self.weight = wx.Choice(self, -1, choices=["Normal", "Light", "Bold"])
        self.label_1 = wx.StaticText(self, -1, _("Size in points:"))
        self.point_size = wx.SpinCtrl(self, -1, "", min=0, max=100)
        self.underline = wx.CheckBox(self, -1, _("Underlined"))
        self.font_btn = wx.Button(self, -1, _("Specific font..."))
        self.static_line_1 = wx.StaticLine(self, -1)
        self.ok_btn = wx.Button(self, wx.ID_OK, _("OK"))
        self.cancel_btn = wx.Button(self, wx.ID_CANCEL, _("Cancel"))

        self.__set_properties()
        self.__do_layout()
        self.value = None
        self.font_btn.Bind(wx.EVT_BUTTON, self.choose_specific_font)
        self.ok_btn.Bind(wx.EVT_BUTTON, self.on_ok) 
Example #17
Source File: panel.py    From admin4 with Apache License 2.0 6 votes vote down vote up
def __init__(self, parent, label, xxx):
        ParamPage.__init__(self, parent, xxx)
        box = wx.StaticBox(self, -1, label)
        box.SetFont(g.labelFont())
        topSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        sizer = wx.FlexGridSizer(len(xxx.styles), 2, 0, 1)
        sizer.AddGrowableCol(1)
        for param in xxx.styles:
            present = xxx.params.has_key(param)
            check = wx.CheckBox(self, paramIDs[param],
                               param + ':', size = (LABEL_WIDTH,-1), name = param)
            check.SetValue(present)
            control = paramDict[param](self, name = param)
            control.Enable(present)
            sizer.AddMany([ (check, 0, wx.ALIGN_CENTER_VERTICAL),
                            (control, 0, wx.ALIGN_CENTER_VERTICAL | wx.GROW) ])
            self.checks[param] = check
            self.controls[param] = control
        topSizer.Add(sizer, 1, wx.ALL | wx.EXPAND, 3)
        self.SetAutoLayout(True)
        self.SetSizer(topSizer)
        topSizer.Fit(self)
    # Set data for a cahced page 
Example #18
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 #19
Source File: wxglade_out.py    From PrimarySchoolMathematics with Apache License 2.0 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyDialog1.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.checkbox_2 = wx.CheckBox(self, wx.ID_ANY, u"+(加法)")
        self.checkbox_3 = wx.CheckBox(self, wx.ID_ANY, u"-(减法)")
        self.checkbox_4 = wx.CheckBox(self, wx.ID_ANY, u"×(乘法)")
        self.checkbox_5 = wx.CheckBox(self, wx.ID_ANY, u"÷(除法)")
        self.checkbox_6 = wx.CheckBox(self, wx.ID_ANY, u"+(加法)")
        self.checkbox_7 = wx.CheckBox(self, wx.ID_ANY, u"-(减法)")
        self.checkbox_8 = wx.CheckBox(self, wx.ID_ANY, u"×(乘法)")
        self.checkbox_9 = wx.CheckBox(self, wx.ID_ANY, u"÷(除法)")
        self.checkbox_10 = wx.CheckBox(self, wx.ID_ANY, u"+(加法)")
        self.checkbox_11 = wx.CheckBox(self, wx.ID_ANY, u"-(减法)")
        self.checkbox_12 = wx.CheckBox(self, wx.ID_ANY, u"×(乘法)")
        self.checkbox_13 = wx.CheckBox(self, wx.ID_ANY, u"÷(除法)")
        self.button_9 = wx.Button(self, wx.ID_ANY, u"提交修改")
        self.button_10 = wx.Button(self, wx.ID_ANY, u"关闭窗口")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade 
Example #20
Source File: wxglade_out.py    From PrimarySchoolMathematics with Apache License 2.0 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.radio_box_1 = wx.RadioBox(self, wx.ID_ANY, u"运算类型选择", choices=[u"加法", u"减法", u"乘法", u"除法"], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.radio_box_2 = wx.RadioBox(self, wx.ID_ANY, u"选择几步运算", choices=[u"一步", u"二步", u"三步"], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.radio_box_3 = wx.RadioBox(self, wx.ID_ANY, u"题型设置", choices=[u"求结果", u"求算数项"], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.button_1 = wx.Button(self, wx.ID_ANY, u"运行项及结果范围设置")
        self.button_2 = wx.Button(self, wx.ID_ANY, u"运算符号设置")
        self.checkbox_1 = wx.CheckBox(self, wx.ID_ANY, u"使用括号")
        self.radio_box_4 = wx.RadioBox(self, wx.ID_ANY, u"加法设置", choices=[u"随机进位", u"加法进位", u"没有进位"], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.radio_box_5 = wx.RadioBox(self, wx.ID_ANY, u"减法设置", choices=[u"随机退位", u"减法退位", u"没有退位"], majorDimension=1, style=wx.RA_SPECIFY_ROWS)
        self.text_ctrl_16 = wx.TextCtrl(self, wx.ID_ANY, "20", style=wx.TE_CENTRE)
        self.button_6 = wx.Button(self, wx.ID_ANY, u"添加口算题")
        self.button_7 = wx.Button(self, wx.ID_ANY, u"清空口算题")
        self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.text_ctrl_2 = wx.TextCtrl(self, wx.ID_ANY, "5", style=wx.TE_CENTRE)
        self.text_ctrl_3 = wx.TextCtrl(self, wx.ID_ANY, "3", style=wx.TE_CENTRE)
        self.text_ctrl_4 = wx.TextCtrl(self, wx.ID_ANY, u"小学生口算题")
        self.text_ctrl_5 = wx.TextCtrl(self, wx.ID_ANY, u"姓名:__________ 日期:____月____日 时间:________ 对题:____道", style=wx.TE_LEFT)
        self.button_8 = wx.Button(self, wx.ID_ANY, u"点此生成口算题打印文档")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade 
Example #21
Source File: refinement.py    From DeepLabCut with GNU Lesser General Public License v3.0 6 votes vote down vote up
def addCheckBoxSlider(self, bodyparts, fileIndex, markersize):
        """
        Adds checkbox and a slider
        """
        self.choiceBox = wx.BoxSizer(wx.VERTICAL)

        self.slider = wx.Slider(
            self,
            -1,
            markersize,
            1,
            markersize * 3,
            size=(250, -1),
            style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS,
        )
        self.slider.Enable(False)
        self.checkBox = wx.CheckBox(self, id=wx.ID_ANY, label="Adjust marker size.")
        self.choiceBox.Add(self.slider, 0, wx.ALL, 5)
        self.choiceBox.Add(self.checkBox, 0, wx.ALL, 5)
        self.SetSizerAndFit(self.choiceBox)
        self.Layout()
        return (self.choiceBox, self.slider, self.checkBox) 
Example #22
Source File: chronolapsegui.py    From chronolapse with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: webcamConfigDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.testwebcambutton = wx.Button(self, wx.ID_ANY, _("Test Webcam"))
        self.webcamtimestampcheck = wx.CheckBox(self, wx.ID_ANY, _("Show Timestamp"))
        self.label_16 = wx.StaticText(self, wx.ID_ANY, _("Format:"))
        self.webcam_timestamp_format = wx.TextCtrl(self, wx.ID_ANY, _("%Y-%m-%d %H:%M:%S"))
        self.label_9 = wx.StaticText(self, wx.ID_ANY, _("File Prefix:"))
        self.webcamprefixtext = wx.TextCtrl(self, wx.ID_ANY, _("cam_"))
        self.label_10 = wx.StaticText(self, wx.ID_ANY, _("Save Folder:"))
        self.webcamsavefoldertext = wx.TextCtrl(self, wx.ID_ANY, "")
        self.webcamsavefolderbrowse = wx.Button(self, wx.ID_ANY, _("..."))
        self.label_11 = wx.StaticText(self, wx.ID_ANY, _("File Format:"))
        self.webcamformatcombo = wx.ComboBox(self, wx.ID_ANY, choices=[_("jpg"), _("png"), _("gif")], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN)
        self.webcamsavebutton = wx.Button(self, wx.ID_OK, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.testWebcamPressed, self.testwebcambutton)
        self.Bind(wx.EVT_BUTTON, self.webcamSaveFolderBrowse, self.webcamsavefolderbrowse)
        # end wxGlade 
Example #23
Source File: components2.py    From pyFileFixity with MIT License 6 votes vote down vote up
def do_layout(self, parent):
    self.panel = wx.Panel(parent)

    self.widget = wx.CheckBox(self.panel)
    self.title = self.createTitle(self.panel)
    self.help_msg = self.createHelpMsgWidget(self.panel)
    self.help_msg.SetMinSize((0, -1))

    vertical_container = wx.BoxSizer(wx.VERTICAL)
    vertical_container.Add(self.title)

    horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL)
    horizontal_sizer.Add(self.widget, 0, wx.EXPAND | wx.RIGHT, 10)
    horizontal_sizer.Add(self.help_msg, 1, wx.EXPAND)

    vertical_container.Add(horizontal_sizer, 0, wx.EXPAND)

    self.panel.SetSizer(vertical_container)
    self.panel.Bind(wx.EVT_SIZE, self.onResize)
    return self.panel 
Example #24
Source File: cfgdlg.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #25
Source File: misc.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent, items):
        wx.Dialog.__init__(self, parent, -1, "Choose scripts",
                           style = wx.DEFAULT_DIALOG_STYLE)

        vsizer = wx.BoxSizer(wx.VERTICAL)

        gsizer = wx.FlexGridSizer(2, 2, 5, 0)

        self.addCombo("first", "Compare script", self, gsizer, items, 0)
        self.addCombo("second", "to", self, gsizer, items, 1)

        vsizer.Add(gsizer)

        self.forceCb = wx.CheckBox(self, -1, "Use same configuration")
        self.forceCb.SetValue(True)
        vsizer.Add(self.forceCb, 0, wx.TOP, 10)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        hsizer.Add((1, 1), 1)

        cancelBtn = gutil.createStockButton(self, "Cancel")
        hsizer.Add(cancelBtn)

        okBtn = gutil.createStockButton(self, "OK")
        hsizer.Add(okBtn, 0, wx.LEFT, 10)

        vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10)

        util.finishWindow(self, vsizer)

        wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
        wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)

        okBtn.SetFocus() 
Example #26
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 #27
Source File: multiple_individuals_refinement_toolbox.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def addCheckBoxSlider(self, bodyparts, fileIndex, markersize):
        """
        Adds checkbox and a slider
        """
        self.choiceBox = wx.BoxSizer(wx.VERTICAL)

        self.slider = wx.Slider(
            self,
            -1,
            markersize,
            1,
            markersize * 3,
            size=(250, -1),
            style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS,
        )
        self.slider.Enable(False)
        self.checkBox = wx.CheckBox(self, id=wx.ID_ANY, label="Adjust marker size.")
        self.choiceBox.Add(self.slider, 0, wx.ALL, 5)
        self.choiceBox.Add(self.checkBox, 0, wx.ALL, 5)
        names = ["Color individuals", "Color bodyparts"]
        self.visualization_radiobox = wx.RadioBox(
            self,
            label="Select the visualization scheme",
            majorDimension=1,
            style=wx.RA_SPECIFY_COLS,
            choices=names,
        )
        self.choiceBox.Add(self.visualization_radiobox, 0, wx.EXPAND | wx.ALL, 10)

        self.SetSizerAndFit(self.choiceBox)
        self.Layout()
        return (self.choiceBox, self.slider, self.checkBox, self.visualization_radiobox) 
Example #28
Source File: titlesdlg.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #29
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 #30
Source File: __init__.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, label, main, option_name, initial_value,
                 extra_callback=None):
        wx.CheckBox.__init__(self, parent, label=label)
        self.main = main
        self.option_name = option_name
        self.option_type = type(initial_value)
        self.SetValue(bool(initial_value))
        self.extra_callback = extra_callback
        self.Bind(wx.EVT_CHECKBOX, self.callback)