Re: Bind key press to call function

2011-11-23 Thread Chris Angelico
On Thu, Nov 24, 2011 at 5:07 PM, Steven D'Aprano wrote: >> This looks like the classic "sigint handler sets a flag that the main >> loop polls" structure. > > Exactly. I am open to alternative methods if they are lightweight. Might be easiest to spin off a thread to do the work, and then have the

Re: Bind key press to call function

2011-11-23 Thread Steven D'Aprano
On Thu, 24 Nov 2011 15:20:09 +1100, Chris Angelico wrote: > On Thu, Nov 24, 2011 at 2:55 PM, Steven D'Aprano > 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 w

Re: Bind key press to call function

2011-11-23 Thread Chris Angelico
On Thu, Nov 24, 2011 at 2:55 PM, Steven D'Aprano 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 s