code.py
def tick(self):
        """ This method should be called in the main loop. It looks 
        at the `previous` state and if the button `is_active`, and 
        then calls the correct callbacks.

        This will return the result of any callback called.
        """

        current = self.is_active()

        if current and not self.previous:
            print("{} was pressed".format(self.name))
            result = self.on_press()
        elif current and self.previous:
            print("{} is held".format(self.name))
            result = self.on_held()
        elif not current and self.previous:
            print("{} was released".format(self.name))
            result = self.on_release()
        else:
            result = self.at_rest()

        # so previous is correctly tracked for next tick
        self.previous = current
        return result
 This method should be called in the main loop. It looks 
        at the `previous` state and if the button `is_active`, and 
        then calls the correct callbacks.

        This will return the result of any callback called.
        
This method should be called in the main loop. It looks
at the `previous` state and if the button `is_active`, and
then calls the correct callbacks.

This will return the result of any callback called.
This method should be called in the main loop . It looks at the ` previous ` state and if the button ` is_active ` and then calls the correct callbacks . This will return the result of any callback called .
def tick(self):
        current = self.is_active()
        if current and not self.previous:
            print("{} was pressed".format(self.name))
            result = self.on_press()
        elif current and self.previous:
            print("{} is held".format(self.name))
            result = self.on_held()
        elif not current and self.previous:
            print("{} was released".format(self.name))
            result = self.on_release()
        else:
            result = self.at_rest()
        self.previous = current
        return result
def tick ( self ) : current = self . is_active ( ) if current and not self . previous : print ( "{} was pressed" . format ( self . name ) ) result = self . on_press ( ) elif current and self . previous : print ( "{} is held" . format ( self . name ) ) result = self . on_held ( ) elif not current and self . previous : print ( "{} was released" . format ( self . name ) ) result = self . on_release ( ) else : result = self . at_rest ( ) self . previous = current return result
This method should be called in the main loop.
This method should be called in the main loop .
""" This method should be called in the main loop. It looks 
        at the `previous` state and if the button `is_active`, and 
        then calls the correct callbacks.

        This will return the result of any callback called.
        """ # so previous is correctly tracked for next tick
self