當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。