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: 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> <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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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 main thread block on the keyboard. ChrisA