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


Python QtGui.QSlider方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QSlider方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QSlider方法的具体用法?Python QtGui.QSlider怎么用?Python QtGui.QSlider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui的用法示例。


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

示例1: set_slider

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def set_slider(self, parent):
        # Note: slider controls the position of xmin, so its range is
        # between `data_xmin` and `data_xmax - width`.
        if self.debug:
            pprint('ScrollingToolQT set_slider\n')
        self.slider = QtGui.QSlider(QtCore.Qt.Horizontal, parent=parent)
        self.slider.setTickPosition(QtGui.QSlider.TicksAbove)

        self.slider.setMinimum(self.data_xmin * self.scale)
        self.slider.setMaximum(self.data_xmax * self.scale)
        self.slider.setTickInterval(
            (self.data_xmax - self.data_xmin) / 10 * self.scale)

        self.slider.setSingleStep(self.width * self.scale * self.scroll_single)
        self.slider.setPageStep(self.width * self.scale * self.scroll_page)
        self.slider.setValue(self.xmin * self.scale)   # set initial position
        self.slider.valueChanged.connect(self.slider_changed)
        parent.addWidget(self.slider) 
开发者ID:tritemio,项目名称:FRETBursts,代码行数:20,代码来源:scroll_gui.py

示例2: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def __init__(self, *args, **kwargs):
        super(Slider, self).__init__(*args, **kwargs)

        self.setStyleSheet("""
            QSlider::groove:horizontal {
                 border: 1px inset qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #565656, stop:1 #848484);
                 border-radius: 6px;
                 height: 10px;
                 background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #848484, stop:1 #919191);
                 margin: 2px 6px;
             }

             QSlider::handle:horizontal {
                 background-color: rgba(0,0,0,0);
                 image: url(:/images/slider_knob.png);
                 border: 0px;
                 width: 18px;
                 margin: -6px; 
                 border-radius: 0px;
             }
        """)

        # set the min height to there is enough drawing space
        # for the custom knob image not to get clipped
        self.setMinimumHeight(18) 
开发者ID:justinfx,项目名称:tutorials,代码行数:27,代码来源:slider.py

示例3: createDEToptGroup

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def createDEToptGroup(self):
        self.detgroupBox = QtGui.QGroupBox("& DET options")
        self.enable_show_label_cb = QtGui.QCheckBox('enable show label name')


        self.label_font_size_sl = QtGui.QSlider(QtCore.Qt.Horizontal)
        self.label_font_size_sl.setRange(5,50)
        self.label_font_size_sp = QtGui.QSpinBox()
        self.label_font_size_sp.setRange(5,50)
        QtCore.QObject.connect(self.label_font_size_sl, QtCore.SIGNAL("valueChanged(int)"),

                               self.label_font_size_sp, QtCore.SLOT("setValue(int)"))
        self.label_font_size_sl.valueChanged.connect(self.change_label_font_size)
        self.label_font_size_sl.setValue(self.__class__.label_font_size)
        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.enable_show_label_cb)
        vbox.addWidget(QtGui.QLabel('label font size'))
        vbox.addWidget(self.label_font_size_sl)
        vbox.addWidget(self.label_font_size_sp)
        vbox.addStretch()
        self.detgroupBox.setLayout(vbox)
        return self.detgroupBox 
开发者ID:lzx1413,项目名称:LabelImgTool,代码行数:24,代码来源:settingDialog.py

示例4: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def __init__(self):
        super(ScrollPlotWindow, self).__init__(show=False, create_axis=True)
        self.slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.slider.valueChanged.connect(self.changeValue)
        self.slider.setTickPosition(QtGui.QSlider.TicksBelow)
        self.slider.setTickInterval(10)
        self.vbox.insertWidget(1, self.slider)
        self.show() 
开发者ID:tritemio,项目名称:FRETBursts,代码行数:10,代码来源:qt4_figure.py

示例5: _addParamSlider

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def _addParamSlider(self, name, maxVal, minVal, defaultVal, container):
        '''Adds a single parameter slider to the passed in container.'''
        # All parameter sliders are handled by the _handleParamChange function
    
        NAME_WIDTH    = 250
        SLIDER_HEIGHT = 20
        SLIDER_WIDTH  = 400
        NUM_TICKS     = 4
        
        # Set up this value slider
        slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        slider.setRange(minVal, maxVal) 
        slider.setValue(defaultVal)
        valRange = maxVal - minVal
        slider.setTickInterval(valRange/NUM_TICKS) # Add five tick marks
        slider.setMinimumSize(SLIDER_WIDTH, SLIDER_HEIGHT)
        slider.setMaximumSize(SLIDER_WIDTH, SLIDER_HEIGHT)
        # Use 'partial' to send the param name to the callback function
        callbackFunction = functools.partial(self._handleParamChange, parameterName=name) 
        slider.valueChanged.connect(callbackFunction) # Whenever the slider is moved, trigger callback function
        self.sliderList.append(slider) # TODO: Do we need this?
    
        # Make box with the name
        nameBox = QtGui.QLabel(name, self)
        nameBox.setMinimumSize(NAME_WIDTH, SLIDER_HEIGHT)
        nameBox.setMaximumSize(NAME_WIDTH, SLIDER_HEIGHT)
        
        # Put the name to the left of the slider
        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(nameBox)
        hbox.addWidget(slider)
        
        # Stick the horizontal box on the bottom of the main vertical box
        container.addLayout(hbox)
        return container 
开发者ID:nasa,项目名称:CrisisMappingToolkit,代码行数:37,代码来源:production_gui.py

示例6: setRange

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def setRange(self, start, end, step):
        if step == 0:
            return
        self.scale = 1. / step
        QSlider.setRange(self, start / step, end / step) 
开发者ID:kklmn,项目名称:xrt,代码行数:7,代码来源:qt.py

示例7: setValue

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def setValue(self, value):
        QSlider.setValue(self, int(value*self.scale)) 
开发者ID:kklmn,项目名称:xrt,代码行数:4,代码来源:qt.py

示例8: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(595, 222)
        self.slider = QtGui.QSlider(Dialog)
        self.slider.setGeometry(QtCore.QRect(30, 100, 451, 22))
        self.slider.setMaximum(100)
        self.slider.setOrientation(QtCore.Qt.Horizontal)
        self.slider.setObjectName(_fromUtf8("slider"))
        self.PWMLabel = QtGui.QLabel(Dialog)
        self.PWMLabel.setGeometry(QtCore.QRect(510, 100, 47, 13))
        self.PWMLabel.setText(_fromUtf8(""))
        self.PWMLabel.setObjectName(_fromUtf8("PWMLabel"))

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
开发者ID:reza-arjmandi,项目名称:rpi-course,代码行数:17,代码来源:gui_slider.py

示例9: _create

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def _create(self, base_frame):
            self.sliders = []
            self.spinboxes = []
            for i in range(len(self.dim_labels)):
                self.sliders.append(QtGui.QSlider(QtCore.Qt.Horizontal))
                self.sliders[i].setRange(0, self.n_slider_steps[i])
                self.connect(self.sliders[i],
                             QtCore.SIGNAL("valueChanged(int)"),
                             partial(self._on_slide, i))
                spinbox = QtGui.QDoubleSpinBox()
                spinbox.setRange(*self.limits[i])
                spinbox.setDecimals(3)
                spinbox.setSingleStep(0.001)
                self.spinboxes.append(spinbox)
                self.connect(self.spinboxes[i],
                             QtCore.SIGNAL("valueChanged(double)"),
                             partial(self._on_pos_edited, i))
            slider_group = QtGui.QGridLayout()
            slider_group.addWidget(QtGui.QLabel("Position"),
                                   0, 0, 1, 3, QtCore.Qt.AlignCenter)
            slider_group.addWidget(QtGui.QLabel("Orientation (Euler angles)"),
                                   0, 3, 1, 3, QtCore.Qt.AlignCenter)
            for i, slider in enumerate(self.sliders):
                slider_group.addWidget(QtGui.QLabel(self.dim_labels[i]), 1, i)
                slider_group.addWidget(slider, 2, i)
                slider_group.addWidget(self.spinboxes[i], 3, i)
            slider_groupbox = QtGui.QGroupBox("Transformation in frame '%s'"
                                              % base_frame)
            slider_groupbox.setLayout(slider_group)
            layout = QtGui.QHBoxLayout()
            layout.addWidget(slider_groupbox)
            layout.addStretch(1)
            return layout 
开发者ID:rock-learning,项目名称:pytransform3d,代码行数:35,代码来源:editor.py

示例10: initUI

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def initUI(self):

            vbox = QtGui.QVBoxLayout()

            sld = QtGui.QSlider(QtCore.Qt.Horizontal, self)
            sld.setFocusPolicy(QtCore.Qt.NoFocus)
            sld.setRange(0, 3600)
            sld.setValue(1800)
            vbox.addWidget(sld)
            
            
            self.wid = AttitudeIndicator()

            sld.valueChanged[int].connect(self.updateRoll)
            vbox.addWidget(self.wid)

            hbox = QtGui.QHBoxLayout()
            hbox.addLayout(vbox)

            sldPitch = QtGui.QSlider(QtCore.Qt.Vertical, self)
            sldPitch.setFocusPolicy(QtCore.Qt.NoFocus)
            sldPitch.setRange(0, 180)
            sldPitch.setValue(90)
            sldPitch.valueChanged[int].connect(self.updatePitch)
            hbox.addWidget(sldPitch)
            
            sldASL = QtGui.QSlider(QtCore.Qt.Vertical, self)
            sldASL.setFocusPolicy(QtCore.Qt.NoFocus)
            sldASL.setRange(-200, 200)
            sldASL.setValue(0)
            sldASL.valueChanged[int].connect(self.updateBaro)
            
            sldT = QtGui.QSlider(QtCore.Qt.Vertical, self)
            sldT.setFocusPolicy(QtCore.Qt.NoFocus)
            sldT.setRange(-200, 200)
            sldT.setValue(0)
            sldT.valueChanged[int].connect(self.updateTarget)
            
            hbox.addWidget(sldT)  
            hbox.addWidget(sldASL)
                      

            self.setLayout(hbox)

            self.setGeometry(50, 50, 510, 510)
            self.setWindowTitle('Attitude Indicator')
            self.show() 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:49,代码来源:ai.py

示例11: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def __init__(self, parent, layer, x, y):
        super(MapViewOverlayInfoWidget, self).__init__()
        self.parent = parent # The parent is a MapViewWidget object
        self.layer  = layer  # The index of the layer in question
        self.x      = x      # Click location
        self.y      = y
        overlay = self.parent.overlays[self.layer] # This is a MapViewOverlay object
        
        # Constants that define the field size
        NAME_WIDTH   = 130
        ITEM_HEIGHT  = 10
        INFO_WIDTH   = 450
        SLIDER_WIDTH = 100
        OPACITY_MAX  = 100
        
        # Set up the visibility checkbox
        self.check_box = QtGui.QCheckBox(self) 
        self.check_box.setChecked(overlay.show)
        self.check_box.stateChanged.connect(self.toggle_visible)

        # Set up the opacity slider
        self.slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.slider.setRange(0, OPACITY_MAX) # 0 to 100 percent
        self.slider.setValue(int(overlay.opacity * OPACITY_MAX))
        self.slider.setTickInterval(25) # Add five tick marks
        self.slider.setMinimumSize(SLIDER_WIDTH, ITEM_HEIGHT)
        self.slider.valueChanged.connect(self.set_transparency) # Whenever the slider is moved, call set_transparency

        # Add the overlay name
        self.name = QtGui.QLabel(overlay.name, self)
        self.name.setMinimumSize(NAME_WIDTH, ITEM_HEIGHT)
        
        # Add the pixel value
        self.value = QtGui.QLabel('...', self) # Display this until the real value is ready
        self.value.setMinimumSize(INFO_WIDTH, ITEM_HEIGHT)

        def get_pixel():
            '''Helper function to retrieve the value of a single pixel in a single layer.'''
            try:
                return self.parent.getPixel(layer, x, y).getInfo()
            except: # features throw ee exception, ignore
                return None

        self.pixel_loader = cmt.util.miscUtilities.waitForEeResult(get_pixel, self.set_pixel_value)

        # Set up all the components in a horizontal box layout
        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.check_box)
        hbox.addWidget(self.name)
        hbox.addWidget(self.slider)
        hbox.addWidget(self.value)

        self.setLayout(hbox) # Call QT function derived from parent QWidget class 
开发者ID:nasa,项目名称:CrisisMappingToolkit,代码行数:55,代码来源:mapclient_qt.py

示例12: setupUi

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QSlider [as 别名]
def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(800, 600)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.splitter = QtGui.QSplitter(self.centralwidget)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName(_fromUtf8("splitter"))
        self.frame = QtGui.QFrame(self.splitter)
        self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtGui.QFrame.Raised)
        self.frame.setObjectName(_fromUtf8("frame"))
        self.verticalLayout = QtGui.QVBoxLayout(self.frame)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.label = QtGui.QLabel(self.frame)
        self.label.setObjectName(_fromUtf8("label"))
        self.verticalLayout.addWidget(self.label)
        self.threshold_slider = QtGui.QSlider(self.frame)
        self.threshold_slider.setOrientation(QtCore.Qt.Horizontal)
        self.threshold_slider.setObjectName(_fromUtf8("threshold_slider"))
        self.verticalLayout.addWidget(self.threshold_slider)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.label_2 = QtGui.QLabel(self.frame)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.verticalLayout.addWidget(self.label_2)
        self.vector_size = QtGui.QLabel(self.frame)
        self.vector_size.setFrameShape(QtGui.QFrame.StyledPanel)
        self.vector_size.setFrameShadow(QtGui.QFrame.Sunken)
        self.vector_size.setObjectName(_fromUtf8("vector_size"))
        self.verticalLayout.addWidget(self.vector_size)
        self.vtk_panel = QtGui.QFrame(self.splitter)
        self.vtk_panel.setFrameShape(QtGui.QFrame.StyledPanel)
        self.vtk_panel.setFrameShadow(QtGui.QFrame.Raised)
        self.vtk_panel.setObjectName(_fromUtf8("vtk_panel"))
        self.horizontalLayout.addWidget(self.splitter)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 27))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
开发者ID:diego0020,项目名称:tutorial-vtk-pyqt,代码行数:51,代码来源:glyph_ui.py


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