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


Groups > comp.lang.python > #16148

Re: Bind key press to call function

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

Show all headers | View raw


On Thu, Nov 24, 2011 at 5:07 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> 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 main thread block on the keyboard.

ChrisA

Back to comp.lang.python | Previous | NextPrevious 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