當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QSlider類代碼示例

本文整理匯總了Python中PySide.QtGui.QSlider的典型用法代碼示例。如果您正苦於以下問題:Python QSlider類的具體用法?Python QSlider怎麽用?Python QSlider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了QSlider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MultiVolumeVisualizationMIP

class MultiVolumeVisualizationMIP(MultiVolumeVisualization):
	"""
	MultiVolumeVisualizationMIP is a visualization that shows
	MIP visualizations of both datasets and adds them
	together. It uses complementary colors for the datasets
	so that the visualization is white in the spots where
	they are the same.
	"""
	def __init__(self):
		super(MultiVolumeVisualizationMIP, self).__init__()

		self.fixedHue = 0

	@overrides(MultiVolumeVisualization)
	def getParameterWidget(self):
		self.hueSlider = QSlider(Qt.Horizontal)
		self.hueSlider.setMaximum(360)
		self.hueSlider.setValue(self.fixedHue)
		self.hueSlider.valueChanged.connect(self.valueChanged)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(QLabel("Base hue"), 0, 0)
		layout.addWidget(self.hueSlider, 0, 1)

		widget = QWidget()
		widget.setLayout(layout)
		return widget

	@overrides(MultiVolumeVisualization)
	def setImageData(self, fixedImageData, movingImageData):
		self.fixedImageData = fixedImageData
		self.movingImageData = movingImageData

	@overrides(MultiVolumeVisualization)
	def updateTransferFunctions(self):
		self.fixedVolProp = self._createVolPropFromImageData(self.fixedImageData)
		self.movingVolProp = self._createVolPropFromImageData(self.movingImageData)

		self.updatedTransferFunction.emit()

	@overrides(MultiVolumeVisualization)
	def valueChanged(self, value):
		self.fixedHue = self.hueSlider.value()
		self.updateTransferFunctions()

	@overrides(MultiVolumeVisualization)
	def setMapper(self, mapper):
		self.mapper = mapper

	def _createVolPropFromImageData(self, imageData):
		volProp = vtkVolumeProperty()
		if imageData is not None:
			color, opacityFunction = CreateRangeFunctions(imageData)
		else:
			color, opacityFunction = CreateEmptyFunctions()
		volProp.SetColor(color)
		volProp.SetScalarOpacity(opacityFunction)

		return volProp
開發者ID:berendkleinhaneveld,項目名稱:Registrationshop,代碼行數:60,代碼來源:MultiVolumeVisualizationMIP.py

示例2: getParameterWidget

	def getParameterWidget(self):
		"""
		Returns a widget with sliders / fields with which properties of this
		volume property can be adjusted.
		:rtype: QWidget
		"""
		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setAlignment(Qt.AlignTop)

		self.sliders = []
		for index in range(7):
			slider = QSlider(Qt.Horizontal)
			slider.setMinimum(0)
			slider.setMaximum(1000)
			slider.setValue(int(math.pow(self.sectionsOpacity[index], 1.0/3.0) * slider.maximum()))
			slider.valueChanged.connect(self.valueChanged)
			self.sliders.append(slider)
			label = QLabel(self.sectionNames[index])
			label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
			layout.addWidget(label, index, 0)
			layout.addWidget(slider, index, 1)

		try:
			from ColumnResizer import ColumnResizer
			columnResizer = ColumnResizer()
			columnResizer.addWidgetsFromLayout(layout, 0)
		except Exception, e:
			print e
開發者ID:berendkleinhaneveld,項目名稱:Registrationshop,代碼行數:29,代碼來源:VolumeVisualizationCT.py

示例3: initUi

    def initUi(self):

        #slider
        slider = QSlider(PySide.QtCore.Qt.Orientation.Horizontal, self)
        slider.setRange(0,2)
        slider.setTickInterval(1)
        slider.setValue(2)
        self.slider = slider

        #.. and corresponding label element
        label = QLabel(self)
        label.setText(self.activation_states[slider.value()])
        self.label = label
        
        #connections
        #PySide.QtCore.QObject.connect(slider, slider.valueChanged, self, self.update_label)
        #self.connect(slider.valueChanged, self.update_label())
        slider.valueChanged[int].connect(self.update_label)
        
        # layout
        lo = QVBoxLayout() 
        lo.addWidget( slider )
        lo.addWidget( label )


        self.setLayout(lo)
開發者ID:socialdevices,項目名稱:manager,代碼行數:26,代碼來源:base.py

示例4: _buildSetupPanel

 def _buildSetupPanel(self):
     '''
     Creates the sub-panel containing control widgets for re-initializing 
     the world on demand.
     '''
     self._percentLbl = QLabel("%")
     self._setupBtn = QPushButton("Setup", self._window)
     self._setupBtn.clicked.connect(self._onSetup)
     
     self._percentObstacleSldr = QSlider(Qt.Horizontal, self._window)
     self._percentObstacleSldr.setTickPosition(QSlider.TickPosition.TicksBelow)
     self._percentObstacleSldr.setTickInterval(10)
     self._percentObstacleSldr.setMinimum(0)
     self._percentObstacleSldr.setMaximum(100)
     self._percentObstacleSldr.valueChanged.connect(self._onPercentSlideChange)
     self._percentObstacleSldr.setValue(33)
     
     layout = QGridLayout()
     layout.addWidget(self._setupBtn, 0, 0, 1, 2)
     layout.addWidget(QLabel("Percent Occupied:"), 1, 0)
     layout.addWidget(self._percentLbl, 1, 1)
     layout.addWidget(self._percentObstacleSldr, 2, 0, 1, 2)
     
     grpBx = QGroupBox("Setup Controls")
     grpBx.setLayout(layout)
     grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
     return grpBx        
開發者ID:tansir1,項目名稱:ReverseAStar,代碼行數:27,代碼來源:gui.py

示例5: createDisplayFields

    def createDisplayFields(self):
        display_widget = QFrame()
        display_widget.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Sunken)
        self.left_layout.addWidget(display_widget)
        self.display_layout = QHBoxLayout()

        # self.turn = self.transcript.current_turn()
        self.time_field = qHotField("time", str, "00:00:00", min_size=75, max_size=75, pos="top", handler=self.update_time)
        self.display_layout.addWidget(self.time_field)
        self.speaker_field = qHotField("speaker", str, " ", min_size=75, max_size=75, pos="top", handler=self.update_speaker)
        self.display_layout.addWidget(self.speaker_field)
        self.utt_field = qHotField("utterance", str, " ", min_size=350, max_size=500, pos="top", handler=self.update_utterance, multiline=True)
        self.utt_field.setStyleSheet("font: 14pt \"Courier\";")
        # self.utt_field.efield.setFont(QFont('SansSerif', 12))
        self.display_layout.addWidget(self.utt_field)

        display_widget.setLayout(self.display_layout)
        self.display_layout.setStretchFactor(self.speaker_field, 0)
        self.display_layout.setStretchFactor(self.utt_field, 1)

        self.transcript_slider = QSlider(QtCore.Qt.Horizontal, self)
        self.display_layout.addWidget(self.transcript_slider)
        self.transcript_slider.setMaximum(100)
        self.connect(self.transcript_slider,
                     QtCore.SIGNAL("sliderMoved(int)"), self.position_transcript)
        self.left_layout.addWidget(self.transcript_slider)
開發者ID:bsherin,項目名稱:shared_tools,代碼行數:26,代碼來源:stepperUI.py

示例6: __init__

 def __init__(self, text, minValue, maxValue, defaultValue ):
     
     QWidget.__init__( self )
     
     validator = QDoubleValidator(minValue, maxValue, 2, self )
     mainLayout = QHBoxLayout( self )
     
     checkBox = QCheckBox()
     checkBox.setFixedWidth( 115 )
     checkBox.setText( text )
     
     lineEdit = QLineEdit()
     lineEdit.setValidator( validator )
     lineEdit.setText( str(defaultValue) )
     
     slider = QSlider( QtCore.Qt.Horizontal )
     slider.setMinimum( minValue*100 )
     slider.setMaximum( maxValue*100 )
     slider.setValue( defaultValue )
     
     mainLayout.addWidget( checkBox )
     mainLayout.addWidget( lineEdit )
     mainLayout.addWidget( slider )
     
     QtCore.QObject.connect( slider, QtCore.SIGNAL( 'valueChanged(int)' ), self.syncWidthLineEdit )
     QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged(QString)' ), self.syncWidthSlider )
     QtCore.QObject.connect( checkBox, QtCore.SIGNAL( "clicked()" ), self.updateEnabled )
     
     self.checkBox = checkBox
     self.slider = slider
     self.lineEdit = lineEdit
     
     self.updateEnabled()
開發者ID:jonntd,項目名稱:mayadev-1,代碼行數:33,代碼來源:__init__.py

示例7: __init__

 def __init__(self, *args, **kwargs ):
     
     self.minimum = 1
     self.maximum = 100
     self.lineEditMaximum = 10000
     
     QMainWindow.__init__( self, *args, **kwargs )
     self.installEventFilter( self )
     #self.setWindowFlags( QtCore.Qt.Drawer )
     self.setWindowTitle( Window_global.title )
     
     widgetMain = QWidget()
     layoutVertical = QVBoxLayout( widgetMain )
     self.setCentralWidget( widgetMain )
     
     layoutSlider = QHBoxLayout()
     lineEdit     = QLineEdit(); lineEdit.setFixedWidth( 100 )
     lineEdit.setText( str( 1 ) )
     validator    = QIntValidator(self.minimum, self.lineEditMaximum, self)
     lineEdit.setValidator( validator )
     slider       = QSlider(); slider.setOrientation( QtCore.Qt.Horizontal )
     slider.setMinimum( self.minimum )
     slider.setMaximum( self.maximum )
     layoutSlider.addWidget( lineEdit )
     layoutSlider.addWidget( slider )
     layoutAngle = QVBoxLayout()
     checkBox = QCheckBox( 'Connect Angle By Tangent' )
     layoutVector = QHBoxLayout()
     leVx = QLineEdit(); leVx.setText( str( 1.000 ) ); leVx.setEnabled( False )
     leVx.setValidator( QDoubleValidator( -100, 100, 5, self ) )
     leVy = QLineEdit(); leVy.setText( str( 0.000 ) ); leVy.setEnabled( False )
     leVy.setValidator( QDoubleValidator( -100, 100, 5, self ) )
     leVz = QLineEdit(); leVz.setText( str( 0.000 ) ); leVz.setEnabled( False )
     leVz.setValidator( QDoubleValidator( -100, 100, 5, self ) )
     layoutAngle.addWidget( checkBox )
     layoutAngle.addLayout( layoutVector )
     layoutVector.addWidget( leVx ); layoutVector.addWidget( leVy ); layoutVector.addWidget( leVz )
     button       = QPushButton( 'Create' )
     
     layoutVertical.addLayout( layoutSlider )
     layoutVertical.addLayout( layoutAngle )
     layoutVertical.addWidget( button )
     
     QtCore.QObject.connect( slider, QtCore.SIGNAL('valueChanged(int)'),   self.sliderValueChanged )
     QtCore.QObject.connect( lineEdit, QtCore.SIGNAL('textEdited(QString)'), self.lineEditValueChanged )
     QtCore.QObject.connect( button, QtCore.SIGNAL('clicked()'), Functions.createPointOnCurve )
     QtCore.QObject.connect( checkBox, QtCore.SIGNAL( 'clicked()'), Functions.setAngleEnabled )
     self.slider = slider
     self.lineEdit = lineEdit
     
     Window_global.slider = slider
     Window_global.button = button
     Window_global.checkBox = checkBox
     Window_global.leVx = leVx
     Window_global.leVy = leVy
     Window_global.leVz = leVz
開發者ID:jonntd,項目名稱:mayadev-1,代碼行數:56,代碼來源:createPointOnCurve.py

示例8: SliderWidget

class SliderWidget(QWidget):
	"""
	SliderWidget
	"""
	valueChanged = Signal(int)

	def __init__(self):
		super(SliderWidget, self).__init__()

		self.label = QLabel()
		self.slider = QSlider(Qt.Horizontal)
		self.spinbox = QSpinBox()

		self.slider.valueChanged.connect(self.changedValue)
		self.spinbox.valueChanged.connect(self.changedValue)

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setVerticalSpacing(0)
		layout.addWidget(self.label, 0, 0)
		layout.addWidget(self.slider, 0, 1)
		layout.addWidget(self.spinbox, 0, 2)
		self.setLayout(layout)

	def setName(self, name):
		"""
		Set the name for the slider
		"""
		self.label.setText(name)

	def setRange(self, range):
		"""
		Set the range for the value
		"""
		self.slider.setMinimum(range[0])
		self.spinbox.setMinimum(range[0])
		self.slider.setMaximum(range[1])
		self.spinbox.setMaximum(range[1])

	def setValue(self, value):
		"""
		Set the value for the slider and the spinbox
		"""
		self.slider.setValue(value)
		self.spinbox.setValue(value)

	def value(self):
		return self.slider.value()

	@Slot(int)
	def changedValue(self, value):
		self.setValue(value)
		self.valueChanged.emit(value)
開發者ID:berendkleinhaneveld,項目名稱:Registrationshop,代碼行數:53,代碼來源:SliderWidget.py

示例9: NumericBox

class NumericBox(QFrame):
    """
    A box with a spinner and a slider to allow easier value manipulation by user
    """
    valueChanged = Signal(float)
    spinner = QDoubleSpinBox
    step = 0.1

    def __init__(self, parent=None):
        super(NumericBox, self).__init__(parent)
        self.slider = QSlider(Qt.Horizontal)

        self.spinner = self.spinner()
        self.spinner.setSingleStep(self.step)

        self.slider.setTickInterval(self.step * 100)
        self.slider.setSingleStep(self.step * 100)

        self.slider.sliderMoved.connect(lambda x: self.spinner.setValue(x / 100))
        self.spinner.valueChanged.connect(self.applyValue)

        self.setLayout(line(self.slider, self.spinner))
        self.layout().setStretch(1, 0)

    def applyValue(self, value):
        self.valueChanged.emit(value)
        self.slider.setValue(value * 100)

    def setValue(self, value):
        self.spinner.setValue(value)
        self.slider.setValue(value * 100)

    def setRange(self, mini, maxi):
        self.spinner.setRange(mini, maxi)
        self.slider.setRange(mini * 100, maxi * 100)

    def value(self):
        return self.spinner.value()
開發者ID:DavideAlidosi,項目名稱:May9,代碼行數:38,代碼來源:mass_attr.py

示例10: getParameterWidget

	def getParameterWidget(self):
		self.hueSlider = QSlider(Qt.Horizontal)
		self.hueSlider.setMaximum(360)
		self.hueSlider.setValue(self.fixedHue)
		self.hueSlider.valueChanged.connect(self.valueChanged)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(QLabel("Base hue"), 0, 0)
		layout.addWidget(self.hueSlider, 0, 1)

		widget = QWidget()
		widget.setLayout(layout)
		return widget
開發者ID:berendkleinhaneveld,項目名稱:Registrationshop,代碼行數:14,代碼來源:MultiVolumeVisualizationMIP.py

示例11: __init__

    def __init__(self, parent=None):
        super(NumericBox, self).__init__(parent)
        self.slider = QSlider(Qt.Horizontal)

        self.spinner = self.spinner()
        self.spinner.setSingleStep(self.step)

        self.slider.setTickInterval(self.step * 100)
        self.slider.setSingleStep(self.step * 100)

        self.slider.sliderMoved.connect(lambda x: self.spinner.setValue(x / 100))
        self.spinner.valueChanged.connect(self.applyValue)

        self.setLayout(line(self.slider, self.spinner))
        self.layout().setStretch(1, 0)
開發者ID:DavideAlidosi,項目名稱:May9,代碼行數:15,代碼來源:mass_attr.py

示例12: __init__

	def __init__(self):
		super(SliderWidget, self).__init__()

		self.label = QLabel()
		self.slider = QSlider(Qt.Horizontal)
		self.spinbox = QSpinBox()

		self.slider.valueChanged.connect(self.changedValue)
		self.spinbox.valueChanged.connect(self.changedValue)

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setVerticalSpacing(0)
		layout.addWidget(self.label, 0, 0)
		layout.addWidget(self.slider, 0, 1)
		layout.addWidget(self.spinbox, 0, 2)
		self.setLayout(layout)
開發者ID:berendkleinhaneveld,項目名稱:Registrationshop,代碼行數:17,代碼來源:SliderWidget.py

示例13: __init__

    def __init__(self, parent=None, name=None):
        QWidget.__init__(self, parent)
        self.name = name
        self.set_format('.3f')

        # create widgets
        self.label = QLabel()
        self.slider = QSlider(QtCore.Qt.Orientation.Horizontal)        
        self.slider.valueChanged.connect(self._update_label)
        
        # set default values
        self.set_range(0, 100)
        self.set_value(50)        

        # create layout for the entire widget
        box = QVBoxLayout()
        box.addWidget(self.label)
        box.addWidget(self.slider)        
        self.setLayout(box)
開發者ID:michaelschaefer,項目名稱:grayscott,代碼行數:19,代碼來源:parameterslider.py

示例14: __init__

	def __init__(self):
		super(SliderFloatWidget, self).__init__()

		self.label = QLabel()
		self.slider = QSlider(Qt.Horizontal)
		self.spinbox = QDoubleSpinBox()

		self.slider.valueChanged.connect(self.changedValueFromSlider)
		self.spinbox.valueChanged.connect(self.changedValueFromSpinBox)

		# Keep track of whether one of the values was changed
		# By setting the value of the slider and the spinbox, valueChanged
		# events are fired. These events have to be ignored
		self._changed = False

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setVerticalSpacing(0)
		layout.addWidget(self.label, 0, 0)
		layout.addWidget(self.slider, 0, 1)
		layout.addWidget(self.spinbox, 0, 2)
		self.setLayout(layout)
開發者ID:berendkleinhaneveld,項目名稱:Registrationshop,代碼行數:22,代碼來源:SliderFloatWidget.py

示例15: __init__

 def __init__(self):
     super(Layer, self).__init__()
     self.orientation = Quaternion()
     self.picked = None
     self.show = QCheckBox()
     self.show.setChecked(True)
     self.alpha_slider = QSlider(QtCore.Qt.Orientation.Horizontal)
     self.alpha_slider.setRange(0, 1024)
     self.alpha_slider.setValue(1024)
     self.alpha_number = QDoubleSpinBox()
     self.alpha_number.setDecimals(3)
     self.alpha_number.setSingleStep(0.01)
     self.alpha_number.setRange(0, 1)
     self.alpha_number.setValue(1)
     self.alpha_slider.valueChanged.connect(self._alphaSliderChanged)
     self.alpha_number.valueChanged.connect(self._alphaNumberChanged)
     self.move = QCheckBox()
     self.move.setChecked(True)
     self.quat = QLineEdit()
     font = QFont('monospace')
     font.setStyleHint(QFont.TypeWriter)
     self.quat.setFont(font)
     default_quat = '+0.000, +1.000, +0.000, +0.000'
     margins = self.quat.textMargins()
     self.quat.setFixedWidth(
         # HACK -------------------------------------------v
         QFontMetrics(self.quat.font()).width(default_quat + '  ') +
         margins.left() + margins.right()
     )
     self.quat.setInputMask('#0.000, #0.000, #0.000, #0.000')
     self.quat.setMaxLength(30)
     self.quat.setText(default_quat)
     self.quat.editingFinished.connect(self._orientationChanged)
     self.nbytes = QLabel()
     self.nbytes.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
     self.nbytes.setText('0')
     self.label = QLabel()
     self.label.setText('<empty>')
開發者ID:mkovacs,項目名稱:sphaira,代碼行數:38,代碼來源:layer.py


注:本文中的PySide.QtGui.QSlider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。