本文整理匯總了Python中PySide2.QtWidgets.QSlider方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QSlider方法的具體用法?Python QtWidgets.QSlider怎麽用?Python QtWidgets.QSlider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide2.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QSlider方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: toggleRelativeFrame
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QSlider [as 別名]
def toggleRelativeFrame(self):
sender = self.sender()
frame = sender.parent().findChild(QtWidgets.QLabel, 'frame_number').text()
sliderValue = sender.parent().findChild(QtWidgets.QSlider, 'frame_opacity_slider').value()
if sender.isChecked():
onionCore.viewRenderOverrideInstance.addRelativeOnion(frame, sliderValue)
else:
onionCore.viewRenderOverrideInstance.removeRelativeOnion(frame)
#
示例2: toggleAbsoluteFrame
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QSlider [as 別名]
def toggleAbsoluteFrame(self):
sender = self.sender()
frame = sender.parent().findChild(QtWidgets.QLabel, 'frame_number').text()
sliderValue = sender.parent().findChild(QtWidgets.QSlider, 'frame_opacity_slider').value()
if sender.isChecked():
onionCore.viewRenderOverrideInstance.addAbsoluteOnion(frame, sliderValue)
else:
onionCore.viewRenderOverrideInstance.removeAbsoluteOnion(frame)
#
示例3: update_label_with_slider
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QSlider [as 別名]
def update_label_with_slider(label: QLabel, slider: QSlider):
if label.display_as_percentage:
min_value = slider.minimum()
percentage = (slider.value() - min_value) / (slider.maximum() - min_value)
label.setText(f"{percentage * 100: 3.0f}%")
else:
label.setText(str(slider.value()))
示例4: _on_slider_update
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QSlider [as 別名]
def _on_slider_update(self, slider: QSlider, field_name: str, _):
self.preferences = dataclasses.replace(
self.preferences,
**{field_name: slider.value()}
)
update_label_with_slider(getattr(self, f"{field_name}_value_label"), slider)