I want to have a time limit in order to enter the input in the following code. In other words, there should be a timer tracking the time and if it exceeds the limit, the code should print out a message like "Game over" automatically without hitting any key. it is a sort of pop-up.
def human(player, panel):
print print_panel(panel)
print 'Your Turn! , Hint: "23" means go to row No.2 column No.3/nYou got 1 min to move.'
start_time = time.time()
end_time = start_time + 60
while True :
move = raw_input('> ')
if move and check(int(move), player, panel):
return int(move)
else:
if (time.time() < end_time):
print 'Wrong move >> please try again.'
else:
print "Game over"
return panel, score(BLACK, panel)
break
the other question is almost the same but the answer is not what I am looking for. I want the code to return a message when the time is over without hitting "ENTER".