Python wx 模块,EVT_SPINCTRL 实例源码

我们从Python开源项目中,提取了以下20个代码示例,用于说明如何使用wx.EVT_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)
项目: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}
项目: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)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(EncapsulatedSpinCtrl, self).__init__(*args, **kwargs)      
        self.control.Bind(wx.EVT_SPINCTRL, self.on_change)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def bind(self, handler, id):
        self._uiobj.Bind(wx.EVT_SPINCTRL, handler, id=id)
项目: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)
项目: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)
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def set_bindings(self):

        self.Bind(wx.EVT_RADIOBOX, self.handle_plottype, 
                  self.choosep.plottype_p.fieldradiobox)
        self.Bind(wx.EVT_RADIOBOX, self.handle_fieldtype, 
                  self.choosep.fieldtype_p.fieldradiobox)
        self.Bind(wx.EVT_COMBOBOX, self.handle_component, 
                  self.choosep.component_p.componentcombobox)
        self.Bind(wx.EVT_COMBOBOX, self.handle_normal, 
                  self.choosep.component_p.normalcombobox)

        self.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.handle_recslider, 
                  self.slidersp.recslider.slider)
        self.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.handle_binslider, 
                  self.slidersp.binslider.slider)
        self.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.handle_recslider, 
                  self.slidersp.recslider.slider)
        self.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.handle_binslider, 
                  self.slidersp.binslider.slider)
        self.Bind(wx.EVT_TEXT_ENTER, self.handle_rectxt,
                  self.slidersp.recslider.slidertext)
        self.Bind(wx.EVT_TEXT_ENTER, self.handle_bintxt,
                  self.slidersp.binslider.slidertext)

        self.Bind(wx.EVT_SPINCTRL, self.handle_recspin,
                  self.slidersp.recslider.spin)
        self.Bind(wx.EVT_SPINCTRL, self.handle_binspin,
                  self.slidersp.binslider.spin)

        self.Bind(wx.EVT_CHECKBOX, self.handle_autoscale, 
                  self.choosep.autoscale_b) 
        self.Bind(wx.EVT_TEXT_ENTER, self.handle_minscale, 
                  self.choosep.minpspin) 
        self.Bind(wx.EVT_TEXT_ENTER, self.handle_maxscale, 
                  self.choosep.maxpspin) 

        self.choosep.save_b.Bind(wx.EVT_BUTTON, 
                                 lambda event: self.save_dialogue(event, 'fig.png'))
        self.choosep.save_d.Bind(wx.EVT_BUTTON, 
                                 lambda event: self.save_dialogue(event, 'data.csv'))
        self.choosep.save_s.Bind(wx.EVT_BUTTON, 
                                 lambda event: self.save_dialogue(event, 'script.py'))
项目: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()