本文整理汇总了Python中PyQt5.QtWidgets.QSlider方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QSlider方法的具体用法?Python QtWidgets.QSlider怎么用?Python QtWidgets.QSlider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QSlider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self):
super().__init__()
self.updating_gui_bool = False
self.toggle_switch = ToggleSwitchWt()
self.both_qrb = RadioButtonLeft(self.tr("Visual + Audio"))
self.visual_qrb = RadioButtonMiddle(self.tr("Visual"))
self.audio_qrb = RadioButtonRight(self.tr("Audio"))
self.notification_interval_qsb = QtWidgets.QSpinBox()
self.notif_select_audio_qpb = QtWidgets.QPushButton(self.tr("Select audio"))
self.notif_volume_qsr = QtWidgets.QSlider()
self.phrases_qlw = RestActionListWt()
self._init_ui()
self._connect_slots_to_signals()
示例2: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self, parent, uiwidget, name):
super(GSBCSlider, self).__init__(parent)
global ui
self.parent = parent
ui = uiwidget
self.setObjectName(name)
self.setOrientation(QtCore.Qt.Horizontal)
if name == 'zoom':
self.setRange(-2000, 2000)
self.setSingleStep(10)
self.setPageStep(10)
elif name == 'speed':
self.setRange(-100, 900)
self.setSingleStep(10)
self.setPageStep(10)
else:
self.setRange(-100, 100)
self.setSingleStep(1)
self.setPageStep(1)
#self.setTickInterval(5)
self.setValue(0)
self.setMouseTracking(True)
self.valueChanged.connect(self.adjust_gsbc_values)
self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
#self.setTickPosition(QtWidgets.QSlider.TicksAbove)
示例3: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.setLayout(QVBoxLayout())
self.layout().setAlignment(Qt.AlignTop)
self.panBox = QGroupBox(self)
self.panBox.setGeometry(0, 0, self.width(), 80)
self.panBox.setLayout(QHBoxLayout(self.panBox))
self.layout().addWidget(self.panBox)
self.panSlider = QSlider(self.panBox)
self.panSlider.setRange(-10, 10)
self.panSlider.setPageStep(1)
self.panSlider.setOrientation(Qt.Horizontal)
self.panSlider.valueChanged.connect(self.pan_changed)
self.panBox.layout().addWidget(self.panSlider)
self.panLabel = QLabel(self.panBox)
self.panLabel.setAlignment(Qt.AlignCenter)
self.panBox.layout().addWidget(self.panLabel)
self.panBox.layout().setStretch(0, 5)
self.panBox.layout().setStretch(1, 1)
self.retransaleUi()
示例4: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
layout = QVBoxLayout(self)
self.imgLabel = QLabel(self)
self.coldSlider = QSlider(Qt.Horizontal, self)
self.coldSlider.valueChanged.connect(self.doChange)
self.coldSlider.setRange(0, 255)
layout.addWidget(self.imgLabel)
layout.addWidget(self.coldSlider)
# 加载图片
self.srcImg = QImage('src.jpg')
self.imgLabel.setPixmap(QPixmap.fromImage(self.srcImg).scaledToWidth(800, Qt.SmoothTransformation))
# DLL库
self.dll = CDLL('Cold.dll')
print(self.dll)
示例5: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self, name, image, feature, alpha=0.5):
super(Visualizer, self).__init__()
self.name = name
self.image = image
self.feature = feature
self.draw_feature = utils.visualize.DrawFeature(alpha)
layout = QtWidgets.QVBoxLayout(self)
fig = plt.Figure()
self.ax = fig.gca()
self.canvas = qtagg.FigureCanvasQTAgg(fig)
layout.addWidget(self.canvas)
toolbar = qtagg.NavigationToolbar2QT(self.canvas, self)
layout.addWidget(toolbar)
self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)
self.slider.setRange(0, feature.shape[0] - 1)
layout.addWidget(self.slider)
self.slider.valueChanged[int].connect(self.on_progress)
self.ax.imshow(self.image)
self.ax.set_xticks([])
self.ax.set_yticks([])
self.on_progress(0)
示例6: _layout_widget_preferences_music
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def _layout_widget_preferences_music(self):
"""
Create music options widget.
"""
tab = QtWidgets.QWidget()
tab_layout = QtWidgets.QVBoxLayout(tab)
# soundtrack section
layout = QtWidgets.QVBoxLayout()
# mute checkbox
checkbox = QtWidgets.QCheckBox('Mute soundtrack')
self._register_check_box(checkbox, constants.Option.SOUNDTRACK_MUTE)
layout.addWidget(checkbox)
# volume slide
layout.addWidget(QtWidgets.QLabel('Volume'))
slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
slider.setTickInterval(25)
slider.setTickPosition(QtWidgets.QSlider.TicksBelow)
slider.setMaximumWidth(100)
self._register_slider(slider, constants.Option.SOUNDTRACK_VOLUME)
layout.addWidget(slider)
# wrap in group box and add to tab
tab_layout.addWidget(qt.wrap_in_groupbox(layout, 'Soundtrack'))
# vertical stretch
tab_layout.addStretch()
# add tab
self.tab_music = tab
self.stacked_layout.addWidget(tab)
示例7: add_brain_settings_widget
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def add_brain_settings_widget(self):
brain_group_box = QtWidgets.QGroupBox("Brain Settings")
brain_group_layout = QtWidgets.QGridLayout()
brain_group_layout.addWidget(QtWidgets.QLabel("Brain Threshold"), 0, 0)
brain_group_layout.addWidget(QtWidgets.QLabel("Brain Opacity"), 1, 0)
brain_group_layout.addWidget(QtWidgets.QLabel("Brain Smoothness"), 2, 0)
brain_group_layout.addWidget(QtWidgets.QLabel("Image Intensity"), 3, 0)
brain_group_layout.addWidget(self.brain_threshold_sp, 0, 1, 1, 2)
brain_group_layout.addWidget(self.brain_opacity_sp, 1, 1, 1, 2)
brain_group_layout.addWidget(self.brain_smoothness_sp, 2, 1, 1, 2)
brain_group_layout.addWidget(self.brain_lut_sp, 3, 1, 1, 2)
brain_group_layout.addWidget(self.brain_projection_cb, 4, 0)
brain_group_layout.addWidget(self.brain_slicer_cb, 4, 1)
brain_group_layout.addWidget(self.create_new_separator(), 5, 0, 1, 3)
brain_group_layout.addWidget(QtWidgets.QLabel("Axial Slice"), 6, 0)
brain_group_layout.addWidget(QtWidgets.QLabel("Coronal Slice"), 7, 0)
brain_group_layout.addWidget(QtWidgets.QLabel("Sagittal Slice"), 8, 0)
# order is important
slicer_funcs = [self.axial_slice_changed, self.coronal_slice_changed, self.sagittal_slice_changed]
current_label_row = 6
# data extent is array [xmin, xmax, ymin, ymax, zmin, zmax)
# we want all the max values for the range
extent_index = 5
for func in slicer_funcs:
slice_widget = QtWidgets.QSlider(Qt.Qt.Horizontal)
slice_widget.setDisabled(True)
self.slicer_widgets.append(slice_widget)
brain_group_layout.addWidget(slice_widget, current_label_row, 1, 1, 2)
slice_widget.valueChanged.connect(func)
slice_widget.setRange(self.brain.extent[extent_index - 1], self.brain.extent[extent_index])
slice_widget.setValue(self.brain.extent[extent_index] / 2)
current_label_row += 1
extent_index -= 2
brain_group_box.setLayout(brain_group_layout)
self.grid.addWidget(brain_group_box, 0, 0, 1, 2)
示例8: get_QSlider
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def get_QSlider():
"""QSlider getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QSlider
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QSlider
示例9: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.setLayout(QVBoxLayout())
self.layout().setAlignment(Qt.AlignTop)
self.groupBox = QGroupBox(self)
self.groupBox.resize(self.size())
self.groupBox.setTitle(
translate('Equalizer10Settings', '10 Bands Equalizer (IIR)'))
self.groupBox.setLayout(QGridLayout())
self.groupBox.layout().setVerticalSpacing(0)
self.layout().addWidget(self.groupBox)
self.sliders = {}
for n in range(10):
label = QLabel(self.groupBox)
label.setMinimumWidth(QFontMetrics(label.font()).width('000'))
label.setAlignment(QtCore.Qt.AlignCenter)
label.setNum(0)
self.groupBox.layout().addWidget(label, 0, n)
slider = QSlider(self.groupBox)
slider.setRange(-24, 12)
slider.setPageStep(1)
slider.setValue(0)
slider.setOrientation(QtCore.Qt.Vertical)
slider.valueChanged.connect(label.setNum)
self.groupBox.layout().addWidget(slider, 1, n)
self.groupBox.layout().setAlignment(slider, QtCore.Qt.AlignHCenter)
self.sliders['band' + str(n)] = slider
fLabel = QLabel(self.groupBox)
fLabel.setStyleSheet('font-size: 8pt;')
fLabel.setAlignment(QtCore.Qt.AlignCenter)
fLabel.setText(self.FREQ[n])
self.groupBox.layout().addWidget(fLabel, 2, n)
示例10: setRange
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def setRange(self, start, end, step):
if step == 0:
return
self.scale = 1. / step
QSlider.setRange(self, start / step, end / step)
示例11: setValue
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def setValue(self, value):
QSlider.setValue(self, int(value*self.scale))
示例12: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self):
super().__init__()
self.setLayout(qtw.QVBoxLayout())
# camera
self.camera = qtmm.QCamera()
# viewfinder
cvf = qtmmw.QCameraViewfinder()
self.camera.setViewfinder(cvf)
self.layout().addWidget(cvf)
# Form
form = qtw.QFormLayout()
self.layout().addLayout(form)
# zoom
zoomslider = qtw.QSlider(
minimum=1,
maximum=10,
sliderMoved=self.on_slider_moved,
orientation=qtc.Qt.Horizontal
)
form.addRow('Zoom', zoomslider)
self.camera.start()
self.show()
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:29,代码来源:question_5_example_code.py
示例13: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
layout = QHBoxLayout(self)
self._value = 0
self._widgets = []
self._timer = QTimer(self, timeout=self.updateValue)
self._widgets.append(PercentProgressBar(self))
layout.addWidget(self._widgets[0])
self._widgets.append(PercentProgressBar(self, clockwise=False))
layout.addWidget(self._widgets[1])
self._widgets.append(PercentProgressBar(self, showPercent=False))
layout.addWidget(self._widgets[2])
self._widgets.append(PercentProgressBar(self, showFreeArea=True))
layout.addWidget(self._widgets[3])
self._widgets.append(PercentProgressBar(self, showSmallCircle=True))
layout.addWidget(self._widgets[4])
self._widgets.append(PercentProgressBar(self, styleSheet="""
qproperty-textColor: rgb(255, 0, 0);
qproperty-borderColor: rgb(0, 255, 0);
qproperty-backgroundColor: rgb(0, 0, 255);
"""))
layout.addWidget(self._widgets[5])
rWidget = QWidget(self)
layout.addWidget(rWidget)
vlayout = QVBoxLayout(rWidget)
self.staticPercentProgressBar = PercentProgressBar(self)
self.staticPercentProgressBar.showFreeArea = True
self.staticPercentProgressBar.ShowSmallCircle = True
vlayout.addWidget(self.staticPercentProgressBar)
vlayout.addWidget(QSlider(self, minimum=0, maximum=100, orientation=Qt.Horizontal,
valueChanged=self.staticPercentProgressBar.setValue))
self._timer.start(100)
示例14: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
self.setAttribute(Qt.WA_StyledBackground, True)
layout = QVBoxLayout(self)
layout.addWidget(QSlider(Qt.Vertical, self))
layout.addWidget(QSlider(Qt.Horizontal, self))
示例15: __init_slider
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QSlider [as 别名]
def __init_slider(self):
slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
slider.setMinimum(self.min)
slider.setMaximum(self.max)
default_val = (self.min+self.max)//2
if isinstance(self.default, int):
if self.min <= self.default <= self.max:
default_val = self.default
self.default = default_val
slider.setValue(default_val)
slider.valueChanged.connect(lambda x: self.label.setText(str(x)))
return slider