Skip to content

Instantly share code, notes, and snippets.

@DataSolveProblems
Created July 9, 2019 10:06
Show Gist options
  • Save DataSolveProblems/25b8e82df40ebe06db3f6039e3afb4c5 to your computer and use it in GitHub Desktop.
Save DataSolveProblems/25b8e82df40ebe06db3f6039e3afb4c5 to your computer and use it in GitHub Desktop.
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