clicked

rumps.clicked(*args, **options)

Decorator for registering a function as a callback for a click action on a rumps.MenuItem within the application. The passed args must specify an existing path in the main menu. The rumps.MenuItem instance at the end of that path will have its rumps.MenuItem.set_callback() method called, passing in the decorated function.

Changed in version 0.2.1: Accepts key keyword argument.

@rumps.clicked('Animal', 'Dog', 'Corgi')
def corgi_button(sender):
    import subprocess
    subprocess.call(['say', '"corgis are the cutest"'])
Parameters:
  • args – a series of strings representing the path to a rumps.MenuItem in the main menu of the application.
  • key – a string representing the key shortcut as an alternative means of clicking the menu item.