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


Groups > comp.lang.python > #16148

Re: Bind key press to call function

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'handler': 0.04; 'structure.': 0.09; 'received:209.85.210.174': 0.13; 'received :mail-iy0-f174.google.com': 0.13; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lightweight.': 0.16; 'subject:function': 0.16; 'subject:key': 0.16; 'wrote:': 0.18; 'header:In-Reply-To:1': 0.22; 'work,': 0.26; '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; 'sets': 0.35; 'thread': 0.37; 'received:google.com': 0.37; 'open': 0.38; 'easiest': 0.38; 'steven': 0.38; 'received:209.85': 0.38; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'might': 0.40; '2011': 0.61; 'alternative': 0.65; '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=SoOTjUWyQm4PwUivikqcF9i5PzcFVQ7SjTbbZx7z+dI=; b=jk0G2DRVaJnU4xiH/Y0GIDLLMat0TG+0SsUgM8YNg7BCrfOGfip4pmz27wL/TaPoaq vVioW30F5lXilDYjxiMk2Vnp1KCcktXlHglxxnHxpZpD9coyK5s+G/8rcDEWIgpW63Jr nwt0mzEAYRxBYwTUxgzzwYYz65yoeV47cm80k=
MIME-Version 1.0
In-Reply-To <4ecddf33$0$30003$c3e8da3$5496439d@news.astraweb.com>
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 Thu, 24 Nov 2011 17:20:30 +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.2992.1322115633.27778.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322115633 news.xs4all.nl 6886 [2001:888:2000:d::a6]:59311
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16148

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