Created
July 9, 2019 10:06
-
-
Save DataSolveProblems/25b8e82df40ebe06db3f6039e3afb4c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import QWidget, QApplication, QDial, QLabel, QVBoxLayout | |
from PyQt5.QtGui import QFont | |
class Demo(QWidget): | |
def __init__(self): | |
super().__init__() | |
self.setWindowTitle('QDial Demo') | |
self.setGeometry(300, 300, 500, 500) | |
self.dial = QDial() | |
self.dial.setMaximum(100) | |
self.dial.setMinimum(0) | |
self.dial.setValue(50) | |
self.dial.valueChanged.connect(self.print_dial_value) | |
self.label = QLabel('Dial Value is ' + str(self.dial.value())) | |
self.label.setFont(QFont('Open Sans', 15)) | |
self.layout = QVBoxLayout() | |
self.layout.addWidget(self.dial) | |
self.layout.addWidget(self.label) | |
self.setLayout(self.layout) | |
def print_dial_value(self): | |
self.label.setText('Dial Value is ' + str(self.dial.value())) | |
app = QApplication(sys.argv) | |
demo = Demo() | |
demo.show() | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment