I have built a game, and I am trying to display a countdown timer display to let the player know how much time he/she has to make a move.
def countdown(sec):
while sec:
minn, secc = divmod(sec, 60)
timeformat = '{:02d}:{:02d}'.format(minn, secc)
self.messages['text'] = timeformat
t.sleep(1)
sec -= 1
countdown(15)
The issue i run into is that this code freeze my application, where the user is unable to play until the countdown finishes. So I am trying to see how I could rewrite this code so that it does not affect the application. I think sleeps puts the game to sleep.
I have used Tkinter to build the interface of my app, and so the timer would need to be displayed on screen.
Thanks in advance.