Skip to content

Button element

Eric Werner edited this page Apr 30, 2018 · 4 revisions

The Button element lets you put some python code thats executed when the user presses the button in you modules user interface.

The code snippet actually has access to the whole python environment. To see whats available make sure you see Python console output and put a snippet like:

from pprint import pprint
pprint(globals())

There will be a huge chunk of Pythons __builtins__ and some a2 specific objects of which currently 2 are specially injected to the globals of the buttons exec.:

  • a2path - string variable containing the absplute path to the active module
  • call_local_ahk - a function to call an Autohotkey file thats in the modules folder.

Here is an example usage of the call_local_ahk functionality:

The text fields available for the dev mode of this element: label text and button text can be used to modify the user interface in the frontend where the label text will make room for the button if left empty:

or here with some label text: