Python : Timer without blocking the window in Tkinter -


for project need do, code bomberman. i'm working software pyzo, in python language, , tkinter. problem have need timer bomb, example, put bomb , exploded 3 seconds after. have tested many different things .after; time module (time.sleep), loop. consequence same, windows freezes , can't move anymore, when loop finished, screen refreshed , players @ new positions.

how can proper timer permit bombs explode after 3 seconds ? thank you!

you can use

widget.after(milliseconds, function, *arguments) 

to let function(*arguments) called after milliseconds. if function takes no arguments use widget.after(milliseconds, function). 1 argument widget.after(milliseconds, function, arg1), ....

widget can tk(), canvas(), frame(), label(), ... object.

if interested in loops: tkinter loop , serial write


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

php - Redirect and hide target URL -