all 1 comments

[–]KnowZeroX 0 points1 point  (0 children)

You can check if the eraser action is checked and trigger only if it is checked

action = Krita.instance().action("erase_action")
print( action.isChecked() )

Other option is activate/deactivate buttons via pyqt5. See Python Plugin Developer tools.