Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtWidgets import *
- import sys
- import time
- from winsound import Beep
- class Window(QWidget):
- def __init__(self):
- QWidget.__init__(self)
- layout = QGridLayout()
- self.setLayout(layout)
- self.dial = QDial()
- self.dial.setGeometry(140, 20, 200, 200)
- self.dial.setMinimum(0)
- self.dial.setMaximum(400)
- self.dial.setValue(40)
- self.dial.valueChanged.connect(self.sliderMoved)
- layout.addWidget(self.dial)
- button = QPushButton('Play/Pause', self)
- button.clicked.connect(self.vajutus)
- def sliderMoved(self):
- print("Dial value = %i" % (self.dial.value()))
- def vajutus(self):
- print(int(self.dial.value()))
- sleep = 60.0 / int(self.dial.value())
- counter = 0
- while True:
- counter += 1
- if counter % 120:
- Beep(440, 100)
- print('tick')
- else:
- Beep(440, 100)
- print('TICK')
- time.sleep(sleep)
- app = QApplication(sys.argv)
- screen = Window()
- screen.show()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement