[Tutor] Listen for input while performing other tasks
Steven D'Aprano
steve at pearwood.info
Sun Nov 25 13:27:13 CET 2012
On 25/11/12 22:06, Sean Carolan wrote:
> I'm working on a python script that runs on a Raspberry Pi. The script
> detects when hardware buttons are pressed, and then runs functions based on
> that input.
Oh I'm sorry, I completely misread what you wrote there. I didn't realise you
were talking about hardware buttons, rather than waiting for a key press. Total
brain-fart there on my part, sorry about that.
[...]
> So far I've only been able to come up with kludgy implementations with lots
> of short time.sleep() calls alternating with checks to see whether the
> buttons were pressed or not.
If you show us how you check whether the button is pressed, we may be able to
show you how to run that asynchronously.
--
Steven
More information about the Tutor
mailing list