I try to use a gui_hooks
named editor_did_init_left_buttons
. The code for the addon below will be triggered whenever we click the Add new card button.
from aqt import gui_hooks
from aqt.utils import showWarning
def button(btn, editor):
showWarning(str(btn))
showWarning(str(editor))
gui_hooks.editor_did_init_buttons.append(button)
The problem is, when I try to print out the content of the first parameter btn
, all I got is an empty list.
I search through the code to figure out where does the hook got triggered and I saw it’s in aqt.editor
.
In the screenshot above, we can see the first argument that is passed to the hook is lefttopbtns
.
But why the addon I wrote is returning an empty list?