omz:software Forums

Pythonista

In reply to: Simple count down timer using .flush() (by Sd.trent)

Re: Simple count down timer using .flush()

Comment Feed

JonB

you have two basic options. your timer should run in a threading.Thread, while you have a loop asking for raw_input.

heres a simple proof of concept https://gist.github.com/195eb18e706736d6d020

you could also use the scene or ui modules. for ui, you would use a textfield's action to check reponses. you would use a Thread to update a timer label. be sure to have a way to abort the thread, such as checking on_screen inside the Thread.

a SceneView might also work, you would draw and check time within draw()...