Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.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.057 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'buttons': 0.09; 'generated,': 0.16; 'pressed': 0.16; 'received:10.20.200': 0.16; 'received:charter.net': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'handles': 0.22; 'header:User-Agent:1': 0.23; 'button,': 0.24; 'push': 0.26; 'header:In-Reply-To:1': 0.27; 'received:24': 0.27; 'received:10.20': 0.33; 'something': 0.35; 'received:10': 0.37; 'button': 0.38; 'message-id:@gmail.com': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'subject:" ': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'event.': 0.60; 'radio': 0.60; 'box,': 0.64; 'become': 0.64 X-Authority-Analysis: v=2.0 cv=Q7eKePKa c=1 sm=1 a=LkTX9YPXWU1lnSxlYEpgVg==:17 a=zewopLiEtFcA:10 a=wgbyeNipIyoA:10 a=nDghuxUhq_wA:10 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=asWdceJ9cU4p2-WMePgA:9 a=QEXdDO2ut3YA:10 a=LkTX9YPXWU1lnSxlYEpgVg==:117 Date: Wed, 09 Apr 2014 08:53:19 -0500 From: Mark H Harris User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: "Latching" variables in function References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397051608 news.xs4all.nl 2840 [2001:888:2000:d::a6]:55929 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69951 On 4/8/14 3:09 PM, Grawburg wrote: > I have a N/O pushbutton that I want to "latch" a value to a variable when it's been pressed. > I need button_value to become '1' when the button is pressed and to remain '1' until ... > What do I use to 'latch' button_value? Philosophically speaking buttons don't latch. You push the button, an event is generated, and the call-back handles the event to do something in your project. You might try setting a global variable on the button-push event. Or, if I understand you, you might want to use a configurable, like a radio button or a check box, either of which are designed to be "latched". marcus