Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16143

Re: Bind key press to call function

References <4ecdc04b$0$30003$c3e8da3$5496439d@news.astraweb.com>
Date 2011-11-24 15:20 +1100
Subject Re: Bind key press to call function
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2988.1322108411.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Nov 24, 2011 at 2:55 PM, Steven D'Aprano
<steve+comp.lang.python@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bind key press to call function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-24 03:55 +0000
  Re: Bind key press to call function Chris Angelico <rosuav@gmail.com> - 2011-11-24 15:20 +1100
    Re: Bind key press to call function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-24 06:07 +0000
      Re: Bind key press to call function Chris Angelico <rosuav@gmail.com> - 2011-11-24 17:20 +1100

csiph-web