ilerlemecubugu.py 709 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/python3
  2. from PyQt5.QtCore import QBasicTimer
  3. from PyQt5.QtWidgets import QProgressBar, QWidget
  4. class IlerlemeCubugu(QWidget):
  5. def __init__(self, ebeveyn=None):
  6. super(IlerlemeCubugu, self).__init__(ebeveyn)
  7. self.pbar = QProgressBar(self)
  8. self.pbar.setGeometry(250, 0, 300, 25)
  9. self.timer = QBasicTimer()
  10. self.step = 0
  11. def timerEvent(self, e):
  12. if self.step >= 100:
  13. self.timer.stop()
  14. return
  15. self.step = self.step + 1
  16. self.pbar.setValue(self.step)
  17. def ilerleyici(self,zaman):
  18. if self.timer.isActive():
  19. self.timer.stop()
  20. else:
  21. self.timer.start(zaman, self)