"Latching" variables in function

Mark H Harris harrismh777 at gmail.com
Wed Apr 9 09:53:19 EDT 2014


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




More information about the Python-list mailing list