当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QSpinBox类代码示例

本文整理汇总了Python中PySide.QtGui.QSpinBox的典型用法代码示例。如果您正苦于以下问题:Python QSpinBox类的具体用法?Python QSpinBox怎么用?Python QSpinBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QSpinBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SpinBoxPySlot

    class SpinBoxPySlot(UsesQApplication, BasicPySlotCase):
        """Tests the connection of python slots to QSpinBox signals"""

        def setUp(self):
            super(SpinBoxPySlot, self).setUp()
            self.spin = QSpinBox()

        def tearDown(self):
            del self.spin
            super(SpinBoxPySlot, self).tearDown()

        def testSpinBoxValueChanged(self):
            """Connection of a python slot to QSpinBox.valueChanged(int)"""
            QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
            self.args = [3]
            self.spin.emit(SIGNAL('valueChanged(int)'), *self.args)
            self.assert_(self.called)

        def testSpinBoxValueChangedImplicit(self):
            """Indirect qt signal emission using QSpinBox.setValue(int)"""
            QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
            self.args = [42]
            self.spin.setValue(self.args[0])
            self.assert_(self.called)

        def atestSpinBoxValueChangedFewArgs(self):
            """Emission of signals with fewer arguments than needed"""
            # XXX: PyQt4 crashes on the assertRaises
            QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
            self.args = (554,)
            self.assertRaises(TypeError, self.spin.emit, SIGNAL('valueChanged(int)'))
开发者ID:Hasimir,项目名称:PySide,代码行数:31,代码来源:signal_emission_gui_test.py

示例2: setup_toolbar

    def setup_toolbar(self):
        color_widget = ColorWidget()
        color_widget.color_changed.connect(self.fourier.on_color_change)
        self.toolBar.addWidget(QLabel("Color:"))
        self.toolBar.addWidget(color_widget)

        self.toolBar.addWidget(QLabel("Shape:"))
        size_spin = QSpinBox(self.toolBar)
        size_spin.setValue(20)
        size_spin.valueChanged[int].connect(self.fourier.on_size_change)

        shape_combo = QComboBox(self.toolBar)
        shape_combo.activated[str].connect(self.fourier.on_shape_change)
        shape_combo.addItems(brush_shapes)

        self.toolBar.addWidget(shape_combo)
        self.toolBar.addWidget(size_spin)

        self.toolBar.addWidget(QLabel("Symmetry:"))
        x_sym = QCheckBox(self.toolBar)
        x_sym.toggled.connect(self.fourier.on_x_toggle)

        opp_sym = QCheckBox(self.toolBar)
        opp_sym.toggled.connect(self.fourier.on_opp_toggle)
        self.toolBar.addWidget(QLabel("X"))
        self.toolBar.addWidget(x_sym)

        y_sym = QCheckBox(self.toolBar)
        y_sym.toggled.connect(self.fourier.on_y_toggle)
        self.toolBar.addWidget(QLabel("Y"))
        self.toolBar.addWidget(y_sym)
        self.toolBar.addWidget(QLabel("Center"))
        self.toolBar.addWidget(opp_sym)
开发者ID:d42,项目名称:Fourierism,代码行数:33,代码来源:fourier_widget.py

示例3: StackSizeCompound

class StackSizeCompound(QGroupBox):
  def __init__(self, parent=None):
    super(StackSizeCompound, self).__init__(parent)
    self.setTitle("Stack size")
    self.spinbox_stacksize = QSpinBox()
    self.spinbox_stacksize.setMaximum(9999)
    self.spinbox_stacksize.setMinimumWidth(100)
    layout = QHBoxLayout()
    layout.addWidget(self.spinbox_stacksize)
    self.setLayout(layout)
开发者ID:github-account-because-they-want-it,项目名称:PokerViewer,代码行数:10,代码来源:widgets.py

示例4: __init__

	def __init__(self):
		self.plate			= QLineEdit()
		self.parents		= QSpinBox()
		self.samples		= QSpinBox()
		self.loadedBy		= QComboBox()
		self.parents.setMaximum(8)
		self.parents.setValue(2)
		self.samples.setMaximum(96)
		self.samples.setValue(94)
		self.loadedBy.addItems(['Column','Row'])
开发者ID:mcvmcv,项目名称:cherry,代码行数:10,代码来源:cherryCreateSamplesDialog.py

示例5: testSpinButton

 def testSpinButton(self):
     #Connecting a lambda to a QPushButton.clicked()
     obj = QSpinBox()
     ctr = Control()
     arg = 444
     func = lambda x: setattr(ctr, 'arg', 444)
     QObject.connect(obj, SIGNAL('valueChanged(int)'), func)
     obj.setValue(444)
     self.assertEqual(ctr.arg, arg)
     QObject.disconnect(obj, SIGNAL('valueChanged(int)'), func)
开发者ID:Hasimir,项目名称:PySide,代码行数:10,代码来源:lambda_gui_test.py

示例6: create_spinbox

 def create_spinbox(self, prefix, suffix, option, default=NoDefault,
                    min_=None, max_=None, step=None, tip=None):
     if prefix:
         plabel = QLabel(prefix)
     else:
         plabel = None
     if suffix:
         slabel = QLabel(suffix)
     else:
         slabel = None
     spinbox = QSpinBox()
     if min_ is not None:
         spinbox.setMinimum(min_)
     if max_ is not None:
         spinbox.setMaximum(max_)
     if step is not None:
         spinbox.setSingleStep(step)
     if tip is not None:
         spinbox.setToolTip(tip)
     self.spinboxes[option] = spinbox
     layout = QHBoxLayout()
     for subwidget in (plabel, spinbox, slabel):
         if subwidget is not None:
             layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
开发者ID:zenotech,项目名称:MyClusterUI,代码行数:29,代码来源:myclusterui.py

示例7: createBinaryOptions

    def createBinaryOptions(self):
        """
        Binary Analysis Options
        """
        groupBox = QtGui.QGroupBox('Binary Analysis')

        # Elements
        cbs_unique_str = QCheckBox('Show unique strings', self)
        cbs_unique_com = QCheckBox('Show unique comments', self)
        cbs_unique_calls = QCheckBox('Show unique calls', self)
        cbs_entropy = QCheckBox('Calculate entropy', self)
        cutoff_label = QLabel('Connect BB cutoff')
        sb_cutoff = QSpinBox()
        sb_cutoff.setRange(1, 40)
        cutoff_func_label = QLabel('Connect functions cutoff')
        sbf_cutoff = QSpinBox()
        sbf_cutoff.setRange(1, 40)

        # Default states are read from the Config
        # class and reflected in the GUI
        cbs_unique_str.setCheckState(
            self.get_state(self.config.display_unique_strings))
        cbs_unique_com.setCheckState(
            self.get_state(self.config.display_unique_comments))
        cbs_unique_calls.setCheckState(
            self.get_state(self.config.display_unique_calls))
        cbs_entropy.setCheckState(
            self.get_state(self.config.calculate_entropy))
        sb_cutoff.setValue(self.config.connect_bb_cutoff)
        sbf_cutoff.setValue(self.config.connect_func_cutoff)

        # Connect elements and signals
        cbs_unique_str.stateChanged.connect(self.string_unique)
        cbs_unique_com.stateChanged.connect(self.comment_unique)
        cbs_unique_calls.stateChanged.connect(self.calls_unique)
        cbs_entropy.stateChanged.connect(self.string_entropy)
        sb_cutoff.valueChanged[int].connect(self.set_cutoff)
        sb_cutoff.valueChanged[int].connect(self.set_func_cutoff)

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(cbs_unique_str)
        vbox.addWidget(cbs_unique_com)
        vbox.addWidget(cbs_unique_calls)
        vbox.addWidget(cbs_entropy)
        vbox.addWidget(cutoff_label)
        vbox.addWidget(sb_cutoff)
        vbox.addWidget(cutoff_func_label)
        vbox.addWidget(sbf_cutoff)
        vbox.addStretch(1)

        groupBox.setLayout(vbox)

        return groupBox
开发者ID:chubbymaggie,项目名称:JARVIS,代码行数:53,代码来源:OptionsWidget.py

示例8: CreateSamplesRow

class CreateSamplesRow():
	def __init__(self):
		self.plate			= QLineEdit()
		self.parents		= QSpinBox()
		self.samples		= QSpinBox()
		self.loadedBy		= QComboBox()
		self.parents.setMaximum(8)
		self.parents.setValue(2)
		self.samples.setMaximum(96)
		self.samples.setValue(94)
		self.loadedBy.addItems(['Column','Row'])
	def getPlate(self):			return self.plate.text()
	def getParents(self):		return self.parents.value()
	def getSamples(self):		return self.samples.value()
	def getLoadedBy(self):		return self.loadedBy.currentText()
开发者ID:mcvmcv,项目名称:cherry,代码行数:15,代码来源:cherryCreateSamplesDialog.py

示例9: testSetValueIndirect

        def testSetValueIndirect(self):
            """Indirect signal emission: QSpinBox using valueChanged(int)/setValue(int)"""
            spinSend = QSpinBox()
            spinRec = QSpinBox()

            spinRec.setValue(5)

            QObject.connect(spinSend, SIGNAL('valueChanged(int)'), spinRec, SLOT('setValue(int)'))
            self.assertEqual(spinRec.value(), 5)
            spinSend.setValue(3)
            self.assertEqual(spinRec.value(), 3)
            self.assertEqual(spinSend.value(), 3)
开发者ID:Hasimir,项目名称:PySide,代码行数:12,代码来源:signal_emission_gui_test.py

示例10: initUi

    def initUi(self):
        self.grid = QGridLayout()
        self.grid.addWidget(QLabel("Connection name"), 0, 0)
        self.grid.addWidget(QLabel("Username"), 2, 0)
        self.grid.addWidget(QLabel("Password"), 4, 0)
        self.grid.addWidget(QLabel("Hostname"), 6, 0)
        self.grid.addWidget(QLabel("Port"), 8, 0)
        self.connectionNameInput =  QLineEdit(self)
        self.grid.addWidget(self.connectionNameInput, 1, 0)
        self.userNameInput =  QLineEdit(self)
        self.grid.addWidget(self.userNameInput, 3, 0)
        self.passwordInput =  QLineEdit(self)
        self.grid.addWidget(self.passwordInput, 5, 0)
        self.hostnameInput =  QLineEdit(self)
        self.grid.addWidget(self.hostnameInput, 7, 0)
        self.portSpinBox =  QSpinBox(self)
        self.portSpinBox.setMinimum(1)
        self.portSpinBox.setMaximum(65535)
        self.portSpinBox.setValue(22)
        self.grid.addWidget(self.portSpinBox, 9, 0)
        self.addButton = QPushButton("Accept")
        self.grid.addWidget(self.addButton, 10, 0)
        self.setLayout(self.grid)

        self.addButton.clicked.connect(self.clickedAddButton)

        self.show()
开发者ID:matiit,项目名称:pyside_connectioin_manager,代码行数:27,代码来源:AddWindow.py

示例11: SpinBoxPySignal

    class SpinBoxPySignal(UsesQApplication):
        """Tests the connection of python signals to QSpinBox qt slots."""

        def setUp(self):
            super(SpinBoxPySignal, self).setUp()
            self.obj = Dummy()
            self.spin = QSpinBox()
            self.spin.setValue(0)

        def tearDown(self):
            super(SpinBoxPySignal, self).tearDown()
            del self.obj
            del self.spin

        def testValueChanged(self):
            """Emission of a python signal to QSpinBox setValue(int)"""
            QObject.connect(self.obj, SIGNAL('dummy(int)'), self.spin, SLOT('setValue(int)'))
            self.assertEqual(self.spin.value(), 0)

            self.obj.emit(SIGNAL('dummy(int)'), 4)
            self.assertEqual(self.spin.value(), 4)

        def testValueChangedMultiple(self):
            """Multiple emissions of a python signal to QSpinBox setValue(int)"""
            QObject.connect(self.obj, SIGNAL('dummy(int)'), self.spin, SLOT('setValue(int)'))
            self.assertEqual(self.spin.value(), 0)

            self.obj.emit(SIGNAL('dummy(int)'), 4)
            self.assertEqual(self.spin.value(), 4)

            self.obj.emit(SIGNAL('dummy(int)'), 77)
            self.assertEqual(self.spin.value(), 77)
开发者ID:Hasimir,项目名称:PySide,代码行数:32,代码来源:pysignal_test.py

示例12: _setup_ui

    def _setup_ui(self):
        layout = QVBoxLayout()

        top_layout = QHBoxLayout()

        top_layout.addWidget(QLabel('Nodes:'))
        self.nodes_edit = QSpinBox(self)
        self.nodes_edit.setValue(50)
        top_layout.addWidget(self.nodes_edit)

        top_layout.addWidget(QLabel('Edges:'))
        self.edges_edit = QSpinBox(self)
        self.edges_edit.setValue(50)
        top_layout.addWidget(self.edges_edit)

        generate_button = QPushButton('Generate')
        generate_button.clicked.connect(self.generate)
        top_layout.addWidget(generate_button)

        top_layout.addWidget(QLabel('Start node:'))
        self.start_edit = QSpinBox(self)
        self.start_edit.setValue(0)
        top_layout.addWidget(self.start_edit)

        top_layout.addWidget(QLabel('Target:'))
        self.target_edit = QSpinBox(self)
        self.target_edit.setValue(25)
        top_layout.addWidget(self.target_edit)

        top_layout.addWidget(QLabel('Delta:'))
        self.delta_edit = QSpinBox(self)
        self.delta_edit.setValue(0)
        top_layout.addWidget(self.delta_edit)

        infect_button = QPushButton('Infect')
        infect_button.clicked.connect(self.infect)
        top_layout.addWidget(infect_button)

        layout.addLayout(top_layout)

        self.image_widget = QSvgWidget(self)
        layout.addWidget(self.image_widget)

        self.setLayout(layout)
开发者ID:brett-patterson,项目名称:ka-infection-interview,代码行数:44,代码来源:simulation_widget.py

示例13: createGUI

 def createGUI(self):
     self.series = QSpinBox()
     self.series.setMinimum(1)
     
     self.repetitions = QSpinBox()
     self.repetitions.setMaximum(512)
     
     self.avgHeartRateToggle = QCheckBox()
     self.avgHeartRateToggle.toggled.connect(self._toggleHeartRateSpinBox)
     
     self.avgHeartRate = QSpinBox()
     self.avgHeartRate.setMinimum(30)
     self.avgHeartRate.setMaximum(250)
     self.avgHeartRate.setValue(120)
     self.avgHeartRate.setDisabled(True)
     
     self.dateSelector_widget = QCalendarWidget()
     self.dateSelector_widget.setMaximumDate(QDate.currentDate())
     
     self.addButton = QPushButton("Add pushup")
     self.addButton.setMaximumWidth(90)
     self.addButton.clicked.connect(self._createPushup)
     
     self.cancelButton = QPushButton("Cancel")
     self.cancelButton.setMaximumWidth(90)
     self.cancelButton.clicked.connect(self.reject)
     
     self.pushupForm.addRow("Series", self.series)
     self.pushupForm.addRow("Repetitions", self.repetitions)
     self.pushupForm.addRow("Store average heart rate ? ", self.avgHeartRateToggle)
     self.pushupForm.addRow("Average Heart Rate", self.avgHeartRate)
     self.pushupForm.addRow("Exercise Date", self.dateSelector_widget)
     
     btnsLayout = QVBoxLayout()
     btnsLayout.addWidget(self.addButton)
     btnsLayout.addWidget(self.cancelButton)        
     btnsLayout.setAlignment(Qt.AlignRight)
     
     layoutWrapper = QVBoxLayout()
     layoutWrapper.addLayout(self.pushupForm)
     layoutWrapper.addLayout(btnsLayout)
     
     self.setLayout(layoutWrapper)        
开发者ID:davcri,项目名称:Pushup-app,代码行数:43,代码来源:PushupForm.py

示例14: __init__

 def __init__(self, parent=None):
   super(DoFPCompound, self).__init__(parent)
   self.setTitle("doFP")
   self.button_execute = QPushButton("Execute ...")
   self.spinbox_iterations = QSpinBox()
   self.spinbox_iterations.setMaximum(9999)
   self.spinbox_iterations.setValue(200)
   self.spinbox_iterations.setToolTip("No. iterations")
   layout = QHBoxLayout()
   layout.addWidget(self.spinbox_iterations)
   layout.addWidget(self.button_execute)
   self.setLayout(layout)
开发者ID:github-account-because-they-want-it,项目名称:PokerViewer,代码行数:12,代码来源:widgets.py

示例15: __init__

    def __init__(self, parent, North="Up", East="Right", South="Down", West="Left",BoxLabel='Power', valueName='Position'):
        QWidget.__init__(self)
        self.North = North
        self.East= East
        self.South = South
        self.West = West
        self.boxLabel = BoxLabel
        buttonLayout = QGridLayout(self)
        northButton = QPushButton(self.North, self)
#        northbutton.click(actionscript)
        
        eastButton = QPushButton(self.East, self)

        southButton = QPushButton(self.South, self)
        
        westButton = QPushButton(self.West, self)
        
        speedSlider = QSlider()
        speedSlider.setTickPosition(QSlider.TicksRight)
        speedSlider.setTickInterval(10)
        speedSlider.TicksRight
        sliderPosition = QSpinBox()
        sliderPosition.setRange(0,101)
        sliderLabel = QLabel(self.boxLabel)
        speedSlider.valueChanged.connect(sliderPosition.setValue)
        sliderPosition.valueChanged.connect(speedSlider.setValue)
        SliderValue = speedSlider.value()
        speedSlider.valueChanged.connect(self.printValue)
        
        #Needs work to fix the layout issues......
        buttonLayout.addWidget(northButton, 1, 1)
        buttonLayout.addWidget(eastButton, 2, 2)
        buttonLayout.addWidget(westButton, 2, 0)
        buttonLayout.addWidget(southButton, 3, 1)
        buttonLayout.addWidget(sliderPosition,1, 3)
        buttonLayout.addWidget(sliderLabel, 0, 3)
        buttonLayout.addWidget(speedSlider, 2, 3, 3,3)
        
        self.setLayout(buttonLayout)
开发者ID:CandidCypher,项目名称:SparkControl0.2.0,代码行数:39,代码来源:FourDirectionButtonWidget.py


注:本文中的PySide.QtGui.QSpinBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。