Module Button :: Class Button
[frames] | no frames]

Class Button

source code

Instance Methods
 
__init__(self, pin, enable=True)
Creates a button instance at given pin.
source code
 
addXButtonListener(self, listener)
Registers a listener function to get notifications when the pushbutton is pressed, released, clicked, double-clicked or long pressed.
source code
 
addButtonListener(self, listener)
Registers a listener function to get notifications when the pushbutton is pressed and released.
source code
 
setEnable(self, enable)
Enables/disables the button events.
source code
Class Variables
  pinsEnabled = []
Method Details

__init__(self, pin, enable=True)
(Constructor)

source code 

Creates a button instance at given pin. If enable = True, the button events are immediately enabled; otherwise they must be enabled by calling setEnable(True).

addXButtonListener(self, listener)

source code 

Registers a listener function to get notifications when the pushbutton is pressed, released, clicked, double-clicked or long pressed. Sequences are: click: BUTTON_PRESSED, BUTTON_RELEASED, BUTTON_CLICKED double-click: BUTTON_PRESSED, BUTTON_RELEASED, BUTTON_PRESSED, BUTTON_RELEASED, BUTTON_DOUBLECLICKED long pressed: BUTTON_PRESSED, BUTTON_LONGPRESSED, BUTTON_RELEASED

Parameters:
  • listener - the listener function (with integer parameter event) to register.

addButtonListener(self, listener)

source code 

Registers a listener function to get notifications when the pushbutton is pressed and released.

Parameters:
  • listener - the listener function (with integer parameter event) to register.