Bind key press to call function

Chris Angelico rosuav at gmail.com
Wed Nov 23 23:20:09 EST 2011


On Thu, Nov 24, 2011 at 2:55 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> I'm looking for a way to interrupt a long-running function on a key
> press, but without halting the function.

I assume there's a reason for not using Ctrl-C and SIGINT with the
signal module?

This looks like the classic "sigint handler sets a flag that the main
loop polls" structure.

ChrisA



More information about the Python-list mailing list