Reputation: 33
I am currently working on a roulette game in tkinter. The problem is that I want the roulette automatically to run after a ceirtan time (20sec). But right now it will only run if the player inputs something inform of pressing a button and entering an amount of money. But I want the roulette to run every 20 sec even if the player didnt bet anything(so no button got pressed). But I cant seem to find out how.
pseudocode:
if no button got pressed after 20 sec: run roulette #(roll roulette without player input and without his money)
Upvotes: 0
Views: 737
Reputation: 1716
Not having any code makes answering this a bit harder. I believe what you're looking for is after. This could run after a time period to check if the user has clicked to play. You should have a variable monitoring the user's clicks and reseting once the game's done.
some real code:
clicked = False
def force_play():
if not clicked:
play()
after(1000 * 20, force_play)
Upvotes: 1