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


Groups > comp.lang.python > #16143

Re: Bind key press to call function

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'handler': 0.04; 'press,': 0.07; 'module?': 0.09; 'structure.': 0.09; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; 'ctrl-c': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:function': 0.16; 'subject:key': 0.16; 'wrote:': 0.18; 'assume': 0.22; 'header:In- Reply-To:1': 0.22; "i'm": 0.26; 'function': 0.27; 'message- id:@mail.gmail.com': 0.28; '24,': 0.29; 'looks': 0.29; 'nov': 0.29; 'pm,': 0.29; 'thu,': 0.32; 'to:addr:python-list': 0.34; 'loop': 0.34; 'flag': 0.34; 'function.': 0.34; 'sets': 0.35; 'but': 0.37; 'received:google.com': 0.37; "there's": 0.37; 'using': 0.38; 'signal': 0.38; 'steven': 0.38; 'received:209.85': 0.38; 'received:209': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'interrupt': 0.84; 'subject:call': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=r1z7Vp0c6yMOZ/aZTlyht0YFZpfBSUzgoKVQkf5wzvg=; b=YvKnV40S/cH+9jSPhBwfxuhdABP1/CYr+pz0HA6fQyggupr+hGkSvIH9D9b1PGVThw 6uX5s6vZjkNv0lSBiUP8CbNkCfKh6Vk9zQtjEMUjrxQPvd90zueg/PRgJwjnTs2CnrnI 9G+MaRWdMGWkDYXcTeawaYW1MhIaC2DKhwy70=
MIME-Version 1.0
In-Reply-To <4ecdc04b$0$30003$c3e8da3$5496439d@news.astraweb.com>
References <4ecdc04b$0$30003$c3e8da3$5496439d@news.astraweb.com>
Date Thu, 24 Nov 2011 15:20:09 +1100
Subject Re: Bind key press to call function
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2988.1322108411.27778.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322108411 news.xs4all.nl 6909 [2001:888:2000:d::a6]:43717
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16143

Show key headers only | 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