Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. from PyQt5.QtWidgets import *
  2. import sys
  3. import time
  4. from winsound import Beep
  5.  
  6. class Window(QWidget):
  7. def __init__(self):
  8. QWidget.__init__(self)
  9. layout = QGridLayout()
  10. self.setLayout(layout)
  11. self.dial = QDial()
  12. self.dial.setGeometry(140, 20, 200, 200)
  13. self.dial.setMinimum(0)
  14. self.dial.setMaximum(400)
  15. self.dial.setValue(40)
  16. self.dial.valueChanged.connect(self.sliderMoved)
  17. layout.addWidget(self.dial)
  18.  
  19. button = QPushButton('Play/Pause', self)
  20. button.clicked.connect(self.vajutus)
  21.  
  22. def sliderMoved(self):
  23. print("Dial value = %i" % (self.dial.value()))
  24.  
  25. def vajutus(self):
  26. print(int(self.dial.value()))
  27. sleep = 60.0 / int(self.dial.value())
  28. counter = 0
  29. while True:
  30. counter += 1
  31. if counter % 120:
  32. Beep(440, 100)
  33. print('tick')
  34. else:
  35. Beep(440, 100)
  36. print('TICK')
  37. time.sleep(sleep)
  38.  
  39.  
  40.  
  41. app = QApplication(sys.argv)
  42. screen = Window()
  43. screen.show()
  44. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement