Python wx 模块,SpinCtrl() 实例源码

我们从Python开源项目中,提取了以下32个代码示例,用于说明如何使用wx.SpinCtrl()

项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initNTrial(self):
        trialSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        trainTrialControlBox = widgets.ControlBox(self, label='Train Trials', orient=wx.VERTICAL)
        self.trainTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTrainTrial), min=2, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTrainTrial, self.trainTrialSpinCtrl)
        self.offlineControls += [self.trainTrialSpinCtrl]
        trainTrialControlBox.Add(self.trainTrialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        trialSizer.Add(trainTrialControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        testTrialControlBox = widgets.ControlBox(self, label='Test Trials', orient=wx.VERTICAL)
        self.testTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTestTrial), min=1, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTestTrial, self.testTrialSpinCtrl)
        self.offlineControls += [self.testTrialSpinCtrl]
        testTrialControlBox.Add(self.testTrialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        trialSizer.Add(testTrialControlBox, proportion=1,
                flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.sizer.Add(trialSizer, proportion=0, flag=wx.EXPAND)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initNTrial(self):
        trialSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        trainTrialControlBox = widgets.ControlBox(self, label='Train Trials', orient=wx.VERTICAL)
        self.trainTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTrainTrial), min=10, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTrainTrial, self.trainTrialSpinCtrl)
        self.offlineControls += [self.trainTrialSpinCtrl]
        trainTrialControlBox.Add(self.trainTrialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        trialSizer.Add(trainTrialControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        testTrialControlBox = widgets.ControlBox(self, label='Test Trials', orient=wx.VERTICAL)
        self.testTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTestTrial), min=1, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTestTrial, self.testTrialSpinCtrl)
        self.offlineControls += [self.testTrialSpinCtrl]
        testTrialControlBox.Add(self.testTrialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        trialSizer.Add(testTrialControlBox, proportion=1,
                flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.sizer.Add(trialSizer, proportion=0, flag=wx.EXPAND)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initNTrial(self):
        trialSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        trainTrialControlBox = widgets.ControlBox(self, label='Train Trials', orient=wx.VERTICAL)
        self.trainTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTrainTrial), min=2, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTrainTrial, self.trainTrialSpinCtrl)
        self.offlineControls += [self.trainTrialSpinCtrl]
        trainTrialControlBox.Add(self.trainTrialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        trialSizer.Add(trainTrialControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        testTrialControlBox = widgets.ControlBox(self, label='Test Trials', orient=wx.VERTICAL)
        self.testTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTestTrial), min=1, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTestTrial, self.testTrialSpinCtrl)
        self.offlineControls += [self.testTrialSpinCtrl]
        testTrialControlBox.Add(self.testTrialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        trialSizer.Add(testTrialControlBox, proportion=1,
                flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.sizer.Add(trialSizer, proportion=0, flag=wx.EXPAND)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initNTrial(self):
        trialSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        trainTrialControlBox = widgets.ControlBox(self, label='Train Trials', orient=wx.VERTICAL)
        self.trainTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTrainTrial), min=10, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTrainTrial, self.trainTrialSpinCtrl)
        self.offlineControls += [self.trainTrialSpinCtrl]
        trainTrialControlBox.Add(self.trainTrialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        trialSizer.Add(trainTrialControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        testTrialControlBox = widgets.ControlBox(self, label='Test Trials', orient=wx.VERTICAL)
        self.testTrialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTestTrial), min=1, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTestTrial, self.testTrialSpinCtrl)
        self.offlineControls += [self.testTrialSpinCtrl]
        testTrialControlBox.Add(self.testTrialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        trialSizer.Add(testTrialControlBox, proportion=1,
                flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.sizer.Add(trialSizer, proportion=0, flag=wx.EXPAND)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initLattice(self):
        latticeSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        latticeSizeXControlBox = widgets.ControlBox(self, label='Lattice Size X', orient=wx.VERTICAL)
        self.latticeSizeXSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.latticeSize[0]), min=1, max=512)
        self.Bind(wx.EVT_SPINCTRL, self.setLatticeSizeX, self.latticeSizeXSpinCtrl)
        self.offlineControls += [self.latticeSizeXSpinCtrl]
        latticeSizeXControlBox.Add(self.latticeSizeXSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        latticeSizer.Add(latticeSizeXControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        latticeSizeYControlBox = widgets.ControlBox(self, label='Lattice Size Y', orient=wx.VERTICAL)
        self.latticeSizeYSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.latticeSize[0]), min=1, max=512)
        self.Bind(wx.EVT_SPINCTRL, self.setLatticeSizeY, self.latticeSizeYSpinCtrl)
        self.offlineControls += [self.latticeSizeYSpinCtrl]
        latticeSizeYControlBox.Add(self.latticeSizeYSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        latticeSizer.Add(latticeSizeYControlBox, proportion=1,
                flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.sizer.Add(latticeSizer, proportion=0, flag=wx.EXPAND)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initOptions(self):
        optionsSizer = wx.BoxSizer(wx.HORIZONTAL)

        kernTypeControlBox = widgets.ControlBox(self, label='Kernel Type', orient=wx.HORIZONTAL)
        self.kernTypeComboBox = wx.ComboBox(self, choices=self.flt.kernMap.keys(),
            value=self.flt.kernType, style=wx.CB_DROPDOWN)
        self.Bind(wx.EVT_COMBOBOX, self.setKernType, self.kernTypeComboBox)
        kernTypeControlBox.Add(self.kernTypeComboBox, proportion=1, flag=wx.ALL, border=8)
        optionsSizer.Add(kernTypeControlBox, proportion=1,
                flag=wx.ALL | wx.ALIGN_CENTER, border=8)

        widthControlBox = widgets.ControlBox(self, label='Width', orient=wx.HORIZONTAL)
        self.widthSpinCtrl = wx.SpinCtrl(self, value=str(self.flt.width), min=2, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setWidth, self.widthSpinCtrl)
        widthControlBox.Add(self.widthSpinCtrl, proportion=1, flag=wx.ALL, border=8)
        optionsSizer.Add(widthControlBox, proportion=0,
                flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=8)

        self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initOptions(self):
        STransConfigPanel.initOptions(self)

        optionsSizer = wx.BoxSizer(wx.HORIZONTAL)

        kurtosisControlBox = widgets.ControlBox(self, label='Kurtosis', orient=wx.VERTICAL)
        self.kurtosisComboBox = wx.ComboBox(self, choices=('Adapt', 'Sub', 'Super'),
            value=self.flt.kurtosis, style=wx.CB_DROPDOWN)
        self.Bind(wx.EVT_COMBOBOX, self.setKurtosis, self.kurtosisComboBox)
        kurtosisControlBox.Add(self.kurtosisComboBox, proportion=1, flag=wx.ALL, border=8)
        optionsSizer.Add(kurtosisControlBox, proportion=1,
                flag=wx.LEFT | wx.RIGHT, border=8)

        maxIterControlBox = widgets.ControlBox(self, label='Max Iter.', orient=wx.HORIZONTAL)
        self.maxIterSpinCtrl = wx.SpinCtrl(self, value=str(self.flt.maxIter), min=50, max=3500)
        self.Bind(wx.EVT_SPINCTRL, self.setMaxIter, self.maxIterSpinCtrl)
        maxIterControlBox.Add(self.maxIterSpinCtrl, proportion=1,
                flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=8)
        optionsSizer.Add(maxIterControlBox, proportion=0,
                flag=wx.RIGHT | wx.EXPAND, border=8)

        #lrControlBox = widgets.ControlBox(self, label='Learning Rate.', orient=wx.HORIZONTAL)

        self.sizer.Add(optionsSizer, proportion=0)
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def __init__(self,parent,slidername,**kwargs):

        wx.Panel.__init__(self,parent,**kwargs)
        sliderlabel = wx.StaticText(self,-1,label=slidername+':',size=(50,-1))
        self.slidertext = wx.TextCtrl(self,-1,style=wx.TE_PROCESS_ENTER,
                                      size=(50,-1))
        self.slider = JumpSlider(self)
        #self.slider = wx.Slider(self)
        spintext = wx.StaticText(self,-1,label=u"\u00B1",size=(10,-1))
        self.spin = wx.SpinCtrl(self,value='0',initial=0,size=(50,-1))

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(sliderlabel,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
        hbox.Add(self.slidertext,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
        hbox.Add(self.slider,1,wx.EXPAND,0)
        hbox.Add(spintext,0,wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10)
        hbox.Add(self.spin,0,wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10)
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(hbox,1,wx.EXPAND,0)
        self.SetSizer(vbox) 
        self.SetValue(0)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def ClearHighlights(self, highlight_type=None):
        if highlight_type is None:
            self.Highlights = []
        else:
            self.Highlights = [(infos, start, end, highlight) for (infos, start, end, highlight) in self.Highlights if highlight != highlight_type]
        for control in self.HighlightControls.itervalues():
            if isinstance(control, (wx.ComboBox, wx.SpinCtrl)):
                control.SetBackgroundColour(wx.NullColour)
                control.SetForegroundColour(wx.NullColour)
            elif isinstance(control, wx.TextCtrl):
                value = control.GetValue()
                control.SetStyle(0, len(value), wx.TextAttr(wx.NullColour))
            elif isinstance(control, wx.gizmos.EditableListBox):
                listctrl = control.GetListCtrl()
                for i in xrange(listctrl.GetItemCount()):
                    listctrl.SetItemBackgroundColour(i, wx.NullColour)
                    listctrl.SetItemTextColour(i, wx.NullColour)
        self.StructureElementsTable.ClearHighlights(highlight_type)
        self.RefreshView()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def ShowHighlights(self):
        type_infos = self.Controler.GetDataTypeInfos(self.TagName)
        for infos, start, end, highlight_type in self.Highlights:
            if infos[0] == "struct":
                self.StructureElementsTable.AddHighlight(infos[1:], highlight_type)
            else:
                control = self.HighlightControls.get((type_infos["type"], infos[0]), None)
                if control is not None:
                    if isinstance(control, (wx.ComboBox, wx.SpinCtrl)):
                        control.SetBackgroundColour(highlight_type[0])
                        control.SetForegroundColour(highlight_type[1])
                    elif isinstance(control, wx.TextCtrl):
                        control.SetStyle(start[1], end[1] + 1, wx.TextAttr(highlight_type[1], highlight_type[0]))
                    elif isinstance(control, wx.gizmos.EditableListBox):
                        listctrl = control.GetListCtrl()
                        listctrl.SetItemBackgroundColour(infos[1], highlight_type[0])
                        listctrl.SetItemTextColour(infos[1], highlight_type[1])
                        listctrl.Select(listctrl.FocusedItem, False)
项目:LalkaChat    作者:DeForce    | 项目源码 | 文件源码
def create_spin(**kwargs):
        panel = kwargs.get('panel')
        value = kwargs.get('value')
        key = kwargs.get('key')
        bind = kwargs.get('bind')
        gui = kwargs.get('gui')

        item_sizer = wx.BoxSizer(wx.HORIZONTAL)
        item_name = MODULE_KEY.join(key)
        style = wx.ALIGN_LEFT
        item_box = wx.SpinCtrl(panel, id=id_renew(item_name, update=True), min=gui['min'], max=gui['max'],
                               initial=int(value), style=style)
        item_text = wx.StaticText(panel, label=translate_key(item_name))
        item_box.Bind(wx.EVT_SPINCTRL, bind)
        item_box.Bind(wx.EVT_TEXT, bind)
        item_sizer.Add(item_text, 0, wx.ALIGN_CENTER)
        item_sizer.Add(item_box)
        return {'item': item_sizer, 'text_size': item_text.GetSize()[0], 'text_ctrl': item_text}
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: ChatFrameGui.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_2 = wx.Panel(self, -1, style=wx.RAISED_BORDER|wx.TAB_TRAVERSAL)
        self.panel_1 = wx.Panel(self, -1, style=wx.RAISED_BORDER|wx.TAB_TRAVERSAL)
        self.panel_3 = wx.Panel(self.panel_1, -1)
        self.panel_4 = wx.Panel(self.panel_1, -1)
        self.frmMain_statusbar = self.CreateStatusBar(1)
        self.lblIpAddress = wx.StaticText(self.panel_4, -1, "IP &Address")
        self.edtIPAddress = wx.TextCtrl(self.panel_4, -1, "127.0.0.1")
        self.spnConnectPort = wx.SpinCtrl(self.panel_4, -1, "8080", min=1, max=65535, style=wx.SP_ARROW_KEYS|wx.SP_WRAP)
        self.btnConnect = wx.ToggleButton(self.panel_4, -1, "&Connect")
        self.lblListenPort = wx.StaticText(self.panel_3, -1, "Listen &on port")
        self.spnListenPort = wx.SpinCtrl(self.panel_3, -1, "8080", min=1, max=65535, style=wx.SP_ARROW_KEYS|wx.SP_WRAP)
        self.btnListen = wx.ToggleButton(self.panel_3, -1, "Lis&ten")
        self.lblReceived = wx.StaticText(self.panel_1, -1, "Received")
        self.edtReceived = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL)
        self.lblSent = wx.StaticText(self.panel_1, -1, "Sent:")
        self.edtSent = wx.TextCtrl(self.panel_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL)
        self.edtToSend = wx.TextCtrl(self.panel_2, -1, "")
        self.btnSend = wx.Button(self.panel_2, -1, "&Send")
        self.btnClose = wx.Button(self.panel_2, -1, "&Close")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def addStaticBoxWithLabels(self):
        boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
        staticBox = wx.StaticBox( self.panel, -1, "Labels within a Frame" )
        staticBoxSizerV = wx.StaticBoxSizer( staticBox, wx.VERTICAL )
        boxSizerV = wx.BoxSizer( wx.VERTICAL )
        staticText1 = wx.StaticText( self.panel, -1, " Choose a number:" )
        boxSizerV.Add( staticText1, 0, wx.ALL)
        staticText2 = wx.StaticText( self.panel, -1, "           Label 2")
        boxSizerV.Add( staticText2, 0, wx.ALL )
        #------------------------------------------------------
        staticBoxSizerV.Add( boxSizerV, 0, wx.ALL )
        boxSizerH.Add(staticBoxSizerV)
        #------------------------------------------------------
        boxSizerH.Add(wx.ComboBox(self.panel, size=(70, -1)))
        #------------------------------------------------------
        boxSizerH.Add(wx.SpinCtrl(self.panel, size=(50, -1), style=wx.BORDER_RAISED))             

        # Add local boxSizer to main frame
        self.statBoxSizerV.Add( boxSizerH, 1, wx.ALL )

    #----------------------------------------------------------
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initNTrial(self):
        trialSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        trialControlBox = widgets.ControlBox(self, label='Num Trials', orient=wx.VERTICAL)
        self.trialSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nTrials), min=1, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setNTrial, self.trialSpinCtrl)
        self.offlineControls += [self.trialSpinCtrl]
        trialControlBox.Add(self.trialSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)

        trialSizer.Add(trialControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.EXPAND, border=10)

        pauseControlBox = widgets.ControlBox(self,
                label='Pause Secs', orient=wx.VERTICAL)

        self.pauseFloatSpin = agwfs.FloatSpin(self, min_val=0.5, max_val=5.0,
                increment=0.5, value=self.pg.pause)
        self.pauseFloatSpin.SetFormat("%f")
        self.pauseFloatSpin.SetDigits(3)
        self.Bind(agwfs.EVT_FLOATSPIN, self.setPause, self.pauseFloatSpin)
        self.offlineControls += [self.pauseFloatSpin]
        pauseControlBox.Add(self.pauseFloatSpin, proportion=0,
            flag=wx.ALL | wx.EXPAND, border=12)

        trialSizer.Add(pauseControlBox, proportion=1,
            flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.sizer.Add(trialSizer, proportion=0, flag=wx.EXPAND)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initRateControls(self):
        """Initialize the sample rate and poll size controls.
        """
        rateSizer = wx.BoxSizer(orient=wx.VERTICAL)

        pollSizeControlBox = widgets.ControlBox(self, label='Poll Size', orient=wx.HORIZONTAL)
        self.pollSizeSpinCtrl = wx.SpinCtrl(self, style=wx.SP_WRAP,
                value=str(self.src.pollSize), min=1, max=32)
        pollSizeControlBox.Add(self.pollSizeSpinCtrl, flag=wx.ALL | wx.EXPAND, border=10)
        self.Bind(wx.EVT_SPINCTRL, self.setPollSize, self.pollSizeSpinCtrl)

        rateSizer.Add(pollSizeControlBox, proportion=0,
                flag=wx.BOTTOM | wx.RIGHT | wx.TOP, border=10)

        self.sizer.Add(rateSizer)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initRateControls(self):
        """Initialize the sample rate and poll size controls.
        """
        rateSizer = wx.BoxSizer(orient=wx.VERTICAL)

        pollSizeControlBox = widgets.ControlBox(self, label='Poll Size', orient=wx.HORIZONTAL)
        self.pollSizeSpinCtrl = wx.SpinCtrl(self, style=wx.SP_WRAP,
                value=str(self.src.pollSize), min=1, max=32)
        pollSizeControlBox.Add(self.pollSizeSpinCtrl, flag=wx.ALL | wx.EXPAND, border=10)
        self.Bind(wx.EVT_SPINCTRL, self.setPollSize, self.pollSizeSpinCtrl)

        rateSizer.Add(pollSizeControlBox, proportion=0,
                flag=wx.BOTTOM | wx.RIGHT | wx.TOP, border=10)

        sampRates = np.array((128,256,512,1024))

        self.sampRateRadios = [wx.RadioButton(self, label=str(sampRates[0])+'Hz', style=wx.RB_GROUP)] +\
                              [wx.RadioButton(self, label=str(sr)+'Hz') for sr in sampRates[1:]]

        self.sampRateRadios[0].SetValue(True)

        sampRateControlBox= widgets.ControlBox(self, label='Sample Rate', orient=wx.VERTICAL)

        for sr,rbtn in zip(sampRates, self.sampRateRadios):
            def sampRadioWrapper(event, sr=sr):
                self.src.setSampRate(sr)

            self.Bind(wx.EVT_RADIOBUTTON, sampRadioWrapper, id=rbtn.GetId())

        for rbtn in self.sampRateRadios[:-1]:
            sampRateControlBox.Add(rbtn, proportion=0,
                    flag=wx.TOP | wx.LEFT | wx.RIGHT, border=10)
        sampRateControlBox.Add(self.sampRateRadios[-1], proportion=0, flag=wx.ALL, border=10)

        rateSizer.Add(sampRateControlBox, proportion=0,
                flag=wx.BOTTOM | wx.RIGHT, border=10)

        self.sizer.Add(rateSizer)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initRateControls(self):
        """Initialize the sample rate and poll size controls.
        """
        rateSizer = wx.BoxSizer(orient=wx.VERTICAL)

        pollSizeControlBox = widgets.ControlBox(self, label='Poll Size', orient=wx.HORIZONTAL)
        self.pollSizeSpinCtrl = wx.SpinCtrl(self, style=wx.SP_WRAP,
                value=str(self.src.pollSize), min=1, max=32)
        pollSizeControlBox.Add(self.pollSizeSpinCtrl, flag=wx.ALL | wx.EXPAND, border=10)
        self.Bind(wx.EVT_SPINCTRL, self.setPollSize, self.pollSizeSpinCtrl)

        rateSizer.Add(pollSizeControlBox, proportion=0,
                flag=wx.BOTTOM | wx.RIGHT | wx.TOP, border=10)

        sampRates = np.array((128,256,512,1024))

        self.sampRateRadios = [wx.RadioButton(self, label=str(sampRates[0])+'Hz', style=wx.RB_GROUP)] +\
                              [wx.RadioButton(self, label=str(sr)+'Hz') for sr in sampRates[1:]]

        self.sampRateRadios[0].SetValue(True)

        sampRateControlBox = widgets.ControlBox(self, label='Sample Rate', orient=wx.VERTICAL)

        for sr,rbtn in zip(sampRates, self.sampRateRadios):
            def sampRadioWrapper(event, sr=sr):
                try:
                    self.src.setSampRate(sr)
                except Exception as e:
                    wx.LogError('Failed to set sample rate: ' + str(e.message))

            self.Bind(wx.EVT_RADIOBUTTON, sampRadioWrapper, id=rbtn.GetId())

        for rbtn in self.sampRateRadios[:-1]:
            sampRateControlBox.Add(rbtn, proportion=0,
                    flag=wx.TOP | wx.LEFT | wx.RIGHT, border=10)
        sampRateControlBox.Add(self.sampRateRadios[-1], proportion=0, flag=wx.ALL, border=10)

        rateSizer.Add(sampRateControlBox, proportion=0,
                flag=wx.BOTTOM | wx.RIGHT, border=10)

        self.sizer.Add(rateSizer)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initOptions(self):
        optionsSizer = wx.BoxSizer(wx.HORIZONTAL)

        # sizes should only be odd, easiest way is to implement this as slider with odd values XXX - idfah

        sizeControlBox = widgets.ControlBox(self, label='Size', orient=wx.HORIZONTAL)
        self.sizeSpinCtrl = wx.SpinCtrl(self, value=str(self.flt.size), min=3, max=100)
        self.Bind(wx.EVT_SPINCTRL, self.setSize, self.sizeSpinCtrl)
        sizeControlBox.Add(self.sizeSpinCtrl, proportion=1, flag=wx.ALL, border=8)
        optionsSizer.Add(sizeControlBox, proportion=0,
                flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=8)

        # need to add slider for noise parameter XXX - idfah

        self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def GetTextCtrlCallBackFunction(self, textctrl, path, refresh=False):
        def OnTextCtrlChanged(event):
            res = self.SetConfNodeParamsAttribute(path, textctrl.GetValue())
            if res != textctrl.GetValue():
                if isinstance(textctrl, wx.SpinCtrl):
                    textctrl.SetValue(res)
                elif res is not None:
                    textctrl.ChangeValue(str(res))
            if refresh:
                wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU, PROJECTTREE, PAGETITLES)
                wx.CallAfter(self.ParentWindow.SelectProjectTreeItem, self.GetTagName())
            event.Skip()
        return OnTextCtrlChanged
项目:bp5000    作者:isaiahr    | 项目源码 | 文件源码
def new_event(self, e):
        h = 220
        d = wx.Dialog(None)
        sc = wx.SpinCtrl(d, pos=(180, 10), min=1,
                         initial=2, max=99, size=(40, 40))
        scl = wx.StaticText(d, pos=(10, 17), label="# of eliminations")
        name = wx.TextCtrl(d, pos=(20, 74),
                           value="My Tournament", size=(190, 40))
        namel = wx.StaticText(d, pos=(20, 57), label="Tournament Name")
        okbtn = wx.Button(d, label='OK', pos=(30, h-70))

        def newev(e):
            d.Close()
            page = ManagementPage(self.nb, name.GetValue(), sc.GetValue())
            self.nb.AddPage(page, name.GetValue())

        d.Bind(wx.EVT_BUTTON, newev, okbtn)
        cancelbtn = wx.Button(d, label='Cancel', pos=(150, h-70))

        def c(e):
            d.Close()

        d.Bind(wx.EVT_BUTTON, c, cancelbtn)
        d.SetSize((250, h))
        d.SetTitle("Create new")
        d.Show(True)
项目:bp5000    作者:isaiahr    | 项目源码 | 文件源码
def options_event(self, e):
        d = wx.Dialog(None)

        o = self.options
        y = 10
        components = []
        for opt in o.listopt():
            t = type(opt[2])
            if t == type(2):
                #sc = wx.SpinCtrl(d, pos=(180, y),
                pass
            if t == type(True):
                chk = wx.CheckBox(d, pos=(180, y) , label=opt[1])
                chk.SetValue(opt[2])
                if opt[0] == "exprender":
                    for i01 in range(0, self.nb.GetPageCount()):
                        if isinstance(self.nb.GetPage(i01), BracketPage):
                            chk.Disable()
                components.append((opt[0], chk))
            y += 30
        d.SetTitle("Options")
        d.SetSize((250, y+100))
        d.ShowModal()
        for x in components:
            o.update(**{x[0]:x[1].GetValue()})
        self.options = o
项目:bp5000    作者:isaiahr    | 项目源码 | 文件源码
def gen(self, e):
        h = 220
        d = wx.Dialog(None)
        sc = wx.SpinCtrl(d, pos=(160, 10), size=(70, 40),
                         min=4, initial=32, max=1024*8)
        scl = wx.StaticText(d, pos=(10, 17), label="# of Players")
        name = wx.TextCtrl(d, pos=(20, 74), value="Player #", size=(190, 40))
        namel = wx.StaticText(d, pos=(20, 57), label="Player Template")
        okbtn = wx.Button(d, label='OK', pos=(30, h-70))

        def newev(e):
            d.Close()
            bstr = ""
            for i in range(1, sc.GetValue()+1):
                bstr += name.GetValue().replace("#", str(i)) + "\n"
            self.elist.SetValue(bstr)

        d.Bind(wx.EVT_BUTTON, newev, okbtn)
        cancelbtn = wx.Button(d, label='Cancel', pos=(150, h-70))

        def c(e):
            d.Close()

        d.Bind(wx.EVT_BUTTON, c, cancelbtn)
        d.SetSize((250, h))
        d.SetTitle("Create new")
        d.Show(True)
项目:bp5000    作者:isaiahr    | 项目源码 | 文件源码
def __init__(self, parent, match, dilog, pos=(0, 0)):
        wx.Panel.__init__(self, parent, pos=pos, size=(300, 75))
        lbltext = "Pick the Winner of the Match"
        lbl = wx.StaticText(self, label=lbltext, pos=(30, 0))
        l1 = wx.StaticText(self, label=str(match.part1), pos=(23, 50))
        l2 = wx.StaticText(self, label=str(match.part2), pos=(173, 50))
        self.w1 = wx.SpinCtrl(self, min=-99, max=99, pos=(30, 20), size=(50, 40))
        self.w2 = wx.SpinCtrl(self, min=-99, max=99, pos=(180, 20), size=(50,40))

        #self.Bind(wx.EVT_BUTTON, dilog.winner1, w1)
        #self.Bind(wx.EVT_BUTTON, dilog.winner2, w2)
项目:wxWize    作者:AndersMunch    | 项目源码 | 文件源码
def create_wxwindow(self):
        return self.initfn(wx.SpinCtrl)(self.parent, self.id, self.value, self.pos, self.size, self.style, self.min, self.max, self.initial, self.name)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        self._uiobj = wx.SpinCtrl(*args, **kwargs)

        self.range = None
        self.default = None
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initARParam(self):
        lowHighFreqSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        lowFreqControlBox = widgets.ControlBox(self, label='Low Freq', orient=wx.VERTICAL)
        self.lowFreqFloatSpin = agwfs.FloatSpin(self, min_val=0.25, max_val=100.0,
                increment=1/4.0, value=self.pg.lowFreq)
        self.lowFreqFloatSpin.SetFormat("%f")
        self.lowFreqFloatSpin.SetDigits(3)
        self.Bind(agwfs.EVT_FLOATSPIN, self.setLowFreq, self.lowFreqFloatSpin)
        self.offlineControls += [self.lowFreqFloatSpin]
        lowFreqControlBox.Add(self.lowFreqFloatSpin, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        lowHighFreqSizer.Add(lowFreqControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        highFreqControlBox = widgets.ControlBox(self, label='High Freq', orient=wx.VERTICAL)

        self.highFreqFloatSpin = agwfs.FloatSpin(self, min_val=0.25, max_val=100.0,
             increment=1/4.0, value=self.pg.highFreq)
        self.highFreqFloatSpin.SetFormat("%f")
        self.highFreqFloatSpin.SetDigits(3)
        self.Bind(agwfs.EVT_FLOATSPIN, self.setHighFreq, self.highFreqFloatSpin)
        self.offlineControls += [self.highFreqFloatSpin]
        highFreqControlBox.Add(self.highFreqFloatSpin, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        lowHighFreqSizer.Add(highFreqControlBox, proportion=1,
                flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.sizer.Add(lowHighFreqSizer, proportion=0, flag=wx.EXPAND)

        freqOrderSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        nFreqControlBox = widgets.ControlBox(self, label='Num Freqs', orient=wx.VERTICAL)
        self.nFreqSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.nFreq), min=1, max=500)
        self.Bind(wx.EVT_SPINCTRL, self.setNFreq, self.nFreqSpinCtrl)
        self.offlineControls += [self.nFreqSpinCtrl]
        nFreqControlBox.Add(self.nFreqSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        freqOrderSizer.Add(nFreqControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        orderControlBox = widgets.ControlBox(self, label='AR Order', orient=wx.VERTICAL)
        self.orderSpinCtrl = wx.SpinCtrl(self, #style=wx.SP_WRAP,
                value=str(self.pg.order), min=2, max=200)
        self.Bind(wx.EVT_SPINCTRL, self.setOrder, self.orderSpinCtrl)
        self.offlineControls += [self.orderSpinCtrl]
        orderControlBox.Add(self.orderSpinCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        freqOrderSizer.Add(orderControlBox, proportion=1,
                flag=wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.sizer.Add(freqOrderSizer, proportion=0, flag=wx.EXPAND)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initRateControls(self):
        """Initialize the poll size control.
        """
        rateSizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        # poll rate
        pollSizeControlBox = widgets.ControlBox(self, label='Poll Size', orient=wx.HORIZONTAL)
        self.pollSizeSpinCtrl = wx.SpinCtrl(self, style=wx.SP_WRAP,
                value=str(self.src.pollSize), min=1, max=32)
        pollSizeControlBox.Add(self.pollSizeSpinCtrl, flag=wx.ALL | wx.EXPAND, border=10)
        self.Bind(wx.EVT_SPINCTRL, self.setPollSize, self.pollSizeSpinCtrl)

        rateSizer.Add(pollSizeControlBox, proportion=0,
                flag=wx.ALL | wx.EXPAND, border=10)

        # speed mode
        speedModeControlBox = widgets.ControlBox(self, label='Speed Mode', orient=wx.HORIZONTAL)
        self.speedModeSpinCtrl = wx.SpinCtrl(self, style=wx.SP_WRAP,
                value=str(self.src.speedMode.value), min=4, max=7)
        speedModeControlBox.Add(self.speedModeSpinCtrl, flag=wx.ALL | wx.EXPAND, border=10)
        self.Bind(wx.EVT_SPINCTRL, self.setSpeedMode, self.speedModeSpinCtrl)

        rateSizer.Add(speedModeControlBox, proportion=0,
                flag=wx.BOTTOM | wx.RIGHT | wx.TOP | wx.EXPAND, border=10)

        # number of channels
        nChans = (32, 64)
        self.nChanRadios = [wx.RadioButton(self, label=str(nChans[0]), style=wx.RB_GROUP)] +\
                           [wx.RadioButton(self, label=str(sr)) for sr in nChans[1:]]

        self.nChanRadios[-1].SetValue(True)

        nChanControlBox = widgets.ControlBox(self, label='Num Chans', orient=wx.HORIZONTAL)

        for nc,rbtn in zip(nChans, self.nChanRadios):
            def nChanRadioWrapper(event, nc=nc):
                try:
                    self.src.setNChan(nc)
                except Exception as e:
                    wx.LogError('Failed to set number of channels: ' + str(e.message))

            self.Bind(wx.EVT_RADIOBUTTON, nChanRadioWrapper, id=rbtn.GetId())

        nChanControlBox.Add(self.nChanRadios[0], proportion=0,
                flag=wx.ALL | wx.EXPAND, border=10)
        for rbtn in self.nChanRadios[1:]:
            nChanControlBox.Add(rbtn, proportion=0,
                    flag=wx.BOTTOM | wx.RIGHT | wx.TOP | wx.EXPAND, border=10)

        rateSizer.Add(nChanControlBox, proportion=0,
                flag=wx.BOTTOM | wx.RIGHT | wx.TOP | wx.EXPAND, border=10)

        self.sizer.Add(rateSizer)
项目:kicad_scripts    作者:NilujePerchut    | 项目源码 | 文件源码
def __init__( self, parent ):
        wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Teardrops", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.CAPTION|wx.CLOSE_BOX|wx.DEFAULT_DIALOG_STYLE )

        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )

        bvs_main = wx.BoxSizer( wx.VERTICAL )

        rbx_actionChoices = [ u"Set Teardrops", u"Remove All Teardrops" ]
        self.rbx_action = wx.RadioBox( self, wx.ID_ANY, u"Action", wx.DefaultPosition, wx.DefaultSize, rbx_actionChoices, 1, wx.RA_SPECIFY_ROWS )
        self.rbx_action.SetSelection( 0 )
        bvs_main.Add( self.rbx_action, 0, wx.ALL, 5 )

        gs_params = wx.GridSizer( 0, 2, 0, 0 )

        self.st_hpercent = wx.StaticText( self, wx.ID_ANY, u"Horizontal percent", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.st_hpercent.Wrap( -1 )
        gs_params.Add( self.st_hpercent, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )

        self.sp_hpercent = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 30 )
        gs_params.Add( self.sp_hpercent, 0, wx.ALL|wx.SHAPED, 5 )

        self.st_vpercent = wx.StaticText( self, wx.ID_ANY, u"Vertical percent", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.st_vpercent.Wrap( -1 )
        gs_params.Add( self.st_vpercent, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )

        self.sp_vpercent = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 100, 70 )
        gs_params.Add( self.sp_vpercent, 0, wx.ALL|wx.SHAPED, 5 )

        self.st_nbseg = wx.StaticText( self, wx.ID_ANY, u"Number of segments", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.st_nbseg.Wrap( -1 )
        gs_params.Add( self.st_nbseg, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )

        self.sp_nbseg = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 2, 100, 10 )
        gs_params.Add( self.sp_nbseg, 0, wx.ALL|wx.SHAPED, 5 )


        bvs_main.Add( gs_params, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND|wx.SHAPED, 5 )

        bhs_modal = wx.BoxSizer( wx.HORIZONTAL )


        bhs_modal.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )

        self.but_cancel = wx.Button( self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
        bhs_modal.Add( self.but_cancel, 0, wx.ALIGN_RIGHT|wx.EXPAND, 5 )

        self.but_ok = wx.Button( self, wx.ID_ANY, u"Ok", wx.DefaultPosition, wx.DefaultSize, 0 )
        bhs_modal.Add( self.but_ok, 0, 0, 5 )


        bvs_main.Add( bhs_modal, 0, wx.EXPAND, 5 )


        self.SetSizer( bvs_main )
        self.Layout()
        bvs_main.Fit( self )

        self.Centre( wx.BOTH )
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def InitUI(self):
        #
        on_hour = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_on"].split(":")[0])
        on_min = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_on"].split(":")[1])
        off_hour = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_off"].split(":")[0])
        off_min = int(MainApp.config_ctrl_pannel.config_dict["time_lamp_off"].split(":")[1])

        # draw the pannel and text
        pnl = wx.Panel(self)
        wx.StaticText(self,  label='Lamp Config;', pos=(20, 10))
        # hour on - first line
        wx.StaticText(self,  label='on time', pos=(10, 50))
        self.on_hour_spin = wx.SpinCtrl(self, min=0, max=23, value=str(on_hour), pos=(80, 35), size=(60, 50))
        self.on_hour_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)
        wx.StaticText(self,  label=':', pos=(145, 50))
        self.on_min_spin = wx.SpinCtrl(self, min=0, max=59, value=str(on_min), pos=(155, 35), size=(60, 50))
        self.on_min_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)
        # length on on period - second line
        wx.StaticText(self,  label='Lamp on for ', pos=(25, 100))
        self.on_period_h_spin = wx.SpinCtrl(self, min=0, max=23, value="", pos=(130, 85), size=(60, 50))
        self.on_period_h_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)
        wx.StaticText(self,  label='hours and ', pos=(195, 100))
        self.on_period_m_spin = wx.SpinCtrl(self, min=0, max=59, value="", pos=(280, 85), size=(60, 50))
        self.on_period_m_spin.Bind(wx.EVT_SPINCTRL, self.on_spun)
        wx.StaticText(self,  label='min', pos=(345, 100))
        # off time - third line (worked out by above or manual input)
        wx.StaticText(self,  label='off time', pos=(10, 150))
        self.off_hour_spin = wx.SpinCtrl(self, min=0, max=23, value=str(off_hour), pos=(80, 135), size=(60, 50))
        self.off_hour_spin.Bind(wx.EVT_SPINCTRL, self.off_spun)
        wx.StaticText(self,  label=':', pos=(145, 150))
        self.off_min_spin = wx.SpinCtrl(self, min=0, max=59, value=str(off_min), pos=(155, 135), size=(60, 50))
        self.off_min_spin.Bind(wx.EVT_SPINCTRL, self.off_spun)
        # cron timing of switches
        wx.StaticText(self,  label='Cron Timing of Switches;', pos=(10, 250))
        wx.StaticText(self,  label='Current                          New', pos=(50, 280))
        lamp_on_string = MainApp.config_ctrl_pannel.get_cron_time("lamp_on.py").strip()
        lamp_off_string = MainApp.config_ctrl_pannel.get_cron_time("lamp_off.py").strip()
        wx.StaticText(self,  label=" on;", pos=(20, 310))
        wx.StaticText(self,  label="off;", pos=(20, 340))
        self.cron_lamp_on = wx.StaticText(self,  label=lamp_on_string, pos=(60, 310))
        self.cron_lamp_off = wx.StaticText(self,  label=lamp_off_string, pos=(60, 340))


        new_on_string = (str(on_min) + " " + str(on_hour) + " * * *")
        new_off_string = (str(off_min) + " " + str(off_hour) + " * * *")
        self.new_on_string_text = wx.StaticText(self,  label=new_on_string, pos=(220, 310))
        self.new_off_string_text = wx.StaticText(self,  label=new_off_string, pos=(220, 340))
        # set lamp period values
        on_period_hour, on_period_min = self.calc_light_period(on_hour, on_min, off_hour, off_min)
        self.on_period_h_spin.SetValue(on_period_hour)
        self.on_period_m_spin.SetValue(on_period_min)
        #ok and cancel buttons
        self.ok_btn = wx.Button(self, label='Ok', pos=(15, 450), size=(175, 30))
        self.ok_btn.Bind(wx.EVT_BUTTON, self.ok_click)
        self.cancel_btn = wx.Button(self, label='Cancel', pos=(315, 450), size=(175, 30))
        self.cancel_btn.Bind(wx.EVT_BUTTON, self.cancel_click)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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()
项目:pywatch    作者:jackburridge    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Frame.__init__(self, parent, title=u"Addition Frame")

        self.model = WatchableDict()
        self.model["a"] = 2
        self.model["b"] = 3

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)

        sizer = wx.BoxSizer(wx.VERTICAL)

        gb_sizer = wx.GridBagSizer(5, 5)
        gb_sizer.SetFlexibleDirection(wx.BOTH)
        gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        self.spin_ctrl_a = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
                                       wx.SP_ARROW_KEYS, 0, 10, 0)
        gb_sizer.Add(self.spin_ctrl_a, wx.GBPosition(0, 0), wx.GBSpan(1, 1),
                     wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
        pywatch.wx.ValueChanger(self.spin_ctrl_a, self.model, "a")

        self.static_text = wx.StaticText(self, wx.ID_ANY, u"+", wx.DefaultPosition, wx.DefaultSize, 0)
        self.static_text.Wrap(-1)
        gb_sizer.Add(self.static_text, wx.GBPosition(0, 1), wx.GBSpan(1, 1),
                     wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.spin_ctrl_b = wx.SpinCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
                                       wx.SP_ARROW_KEYS, 0, 10, 0)
        gb_sizer.Add(self.spin_ctrl_b, wx.GBPosition(0, 2), wx.GBSpan(1, 1),
                     wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
        pywatch.wx.ValueChanger(self.spin_ctrl_b, self.model, "b")

        self.static_text_out = wx.StaticText(self, wx.ID_ANY, u"{}", wx.DefaultPosition, wx.DefaultSize, 0)
        self.static_text_out.Wrap(-1)
        gb_sizer.Add(self.static_text_out, wx.GBPosition(1, 0), wx.GBSpan(1, 3),
                     wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5)
        pywatch.wx.LabelWatcher(self.static_text_out, self.model, ("a", "b", lambda: self.model["a"] + self.model["b"]))

        self.gauge = wx.Gauge(self, wx.ID_ANY, 20, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL)
        self.gauge.SetValue(0)
        gb_sizer.Add(self.gauge, wx.GBPosition(2, 0), wx.GBSpan(1, 3),
                     wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 0)
        pywatch.wx.ValueWatcher(self.gauge, self.model, ("a", "b", lambda: self.model["a"] + self.model["b"]))

        gb_sizer.AddGrowableCol(0)
        gb_sizer.AddGrowableCol(2)

        sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(sizer)
        self.Layout()

        self.Centre(wx.BOTH)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent, rate=None, out_dir=None, in_dir=None):
        super(FFmpegConvertDialog, self).__init__(parent=parent, title="pyjam Audio Converter",
                                                  style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.in_dir = in_dir

        self.game_rate = intctrl.IntCtrl(self)
        game_rate_text = wx.StaticText(self, label="Audio rate")
        if rate is not None:
            self.game_rate.SetValue(rate)

        self.volume = wx.SpinCtrl(self, initial=85)
        volume_text = wx.StaticText(self, label="Volume %")

        self.in_picker = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL)
        in_picker_text = wx.StaticText(self, label="Input file names (manually changing them has no effect)")
        self.in_files = []
        # the dumbest thing i've done all year (i'm overriding the controls of the PickerBase)
        for child in self.in_picker.GetChildren():
            if isinstance(child, wx.Button):
                child.Bind(wx.EVT_BUTTON, self.browse)

        self.out_dir = wx.DirPickerCtrl(self, name="Output directory")
        out_dir_text = wx.StaticText(self, label="Output directory")
        if out_dir is not None:
            self.out_dir.SetPath(out_dir)

        top_sizer = wx.BoxSizer(wx.VERTICAL)
        top_row = wx.BoxSizer(wx.HORIZONTAL)
        rate_sizer = wx.BoxSizer(wx.VERTICAL)
        vol_sizer = wx.BoxSizer(wx.VERTICAL)
        dir_sizer = wx.BoxSizer(wx.VERTICAL)
        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        rate_sizer.Add(game_rate_text, 0, wx.ALL ^ wx.BOTTOM | wx.ALIGN_LEFT, 5)
        rate_sizer.Add(self.game_rate, 0, wx.ALL | wx.ALIGN_LEFT, 5)
        vol_sizer.Add(volume_text, 0, wx.ALL ^ wx.BOTTOM | wx.ALIGN_LEFT, 5)
        vol_sizer.Add(self.volume, 0, wx.ALL | wx.ALIGN_LEFT, 5)
        top_row.Add(rate_sizer)
        top_row.Add(vol_sizer)
        dir_sizer.Add(in_picker_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        dir_sizer.Add(self.in_picker, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        dir_sizer.Add(out_dir_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        dir_sizer.Add(self.out_dir, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        top_sizer.Add(top_row)
        top_sizer.Add(dir_sizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_TOP, 5)
        top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        self.Bind(wx.EVT_BUTTON, self.on_ok, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, id=wx.ID_CANCEL)

        self.converter = None
        self.progress_dialog = None
        self.num_songs = 0

        self.SetSizer(top_sizer)
        # self.SetSize(400, 250)
        self.Center()
        self.ShowModal()