当前位置: 首页>>代码示例>>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;未经允许,请勿转载。