Try using the function timelimited from this recipe <http://code.activestate.com/recipes/576780/>
An (untested) example with a 60 second timeout would be: try: r = timelimited(60, raw_input, 'enter right or wrong: ') except TimeLimitExpired: .... except KeyboardInterrupt: .... /Jean On Dec 4, 3:52 pm, northof40 <shearich...@gmail.com> wrote: > Hi - I'm writing a *very* simple program for my kids. It asks the user > to give it the answer to a maths question and says "right" or "wrong" > > They now want a timed version where they would only get so long to > respond to the question. > > I'm thinking of some logic where a raw_input call is executed and then > if more than X seconds elapses before the prompt is replied to the > process writes a message "Sorry too slow" (or similar). > > I can't see the wood for the trees here - what's the best way to do > this given the rather simple environment it's needed within. > > Regards > > richard. -- http://mail.python.org/mailman/listinfo/python-list