Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. def start_timer(self):
  2. self.time_label.setText('0:00')
  3. if not self.time_is_on:
  4. self.startTimer(1000)
  5. self.time_is_on = True
  6.  
  7. # функция считающая время
  8. def timerEvent(self, *args, **kwargs):
  9. if self.game_is_on:
  10. time = [int(i) for i in self.time_label.text().split(':')]
  11. mins = time[0] * 60 + time[1]
  12. mins += 1
  13. self.time_label.setText(':'.join([str(mins // 60), str(mins % 60).rjust(2, '0')]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement