What exactly is a plugin?

The page “How to make a Krita Python plugin” says that the advantage of turining a script into a plugin is that you can “do more with it”, “run it automatically for instance”, that it “can give you much more flexibility and power”.

But what exactly is meant by that?

Run it automatically when? (Apart from upon Krita start, which is then called “Extension”.) Is there a list of events (for example brush stroke) that I can choose from that can trigger this automatic run? If it’s related to “signals like Action.triggered or QPushButton.clicked”, where is the info about what signal names mean what for Krita (for example brush stroke).

What does “do more”/“more flexibility and power” mean? What can a plugin do that a script can’t do?

A plugin can define an action or a docker. If it’s an action, then you can assign a shortcut to it and when you use the shortcut, that action happens. If it’s a docker, then you get a docker with buttons and everything else, and those buttons can do stuff too. Scripts are kind of… you need to open the Scripter first to run it. With a plugin you already have all of it saved and you can access it more directly than going into a Scripter and then running a script.

There is not really a way to access brush strokes though.

There is lots of potential and lots of different purposes. You can check my Life Drawing Plugin for example - Life Drawing Sessions plugin - version 0.9.1 (alpha) - update May 8th '20 - or there are also plugins to get nicer color selectors or other things. There is Pigment.O plugin and KanvasBuddy - a Minimalist Toolbar and lots of other things: https://docs.krita.org/en/resources_page.html#user-made-python-plugins

There is a new scripting site in the making that has a section that shows all the actions and all the icons, you can get the link here: New Krita Scripting website feedback but it will be on krita.org when it’s finished.

1 Like

This page says “run it automatically”. Run it automatically when? (Apart from upon Krita start, which is then called “Extension”.) Is there a list of events that I can choose from that can trigger this automatic run?

The page also mentions “signals like Action.triggered or QPushButton.clicked”. Can automatic execution be triggered by signals? What other signals exist? Is there a list of more signal names (“like Action.triggered or QPushButton.clicked”) and their meanings for Krita (for example brush stroke)? If brush stroke is not in that list, what is in that list? Where is the list?

A Plugin is a user installed code that like unlocks/creates new experiences with what is possible through the API.

I am not the best to explain very well since I am not really a programmer at heart, but I will try:

Addons and Actions run on the Start, and then it is like live or active and you can call it anytime with signals. Signals are made by the UI or some shortcut you create for them in Actions.

for the list of the signals I suggest you simply install “Qt Designer” as everything is open there right away and you can inspect any element and see the type of elements that it can send if you choose to create an UI with PyQt5. Or else you will be handling with your own signals I imagine.

events - https://www.riverbankcomputing.com/static/Docs/PyQt4/qevent.html
signals - https://www.riverbankcomputing.com/static/Docs/PyQt5/signals_slots.html
for Krita’s current list of pre-baked actions, write this on the scripter:

from krita import *
[print([a.objectName(), a.text()]) for a in Krita.instance().actions()]

What are concrete examples of signals? As many examples as possible are welcome. Does a brush stroke send a signal? If not, why not?

you haven’t read any response yet right?
click the signal link and no, there is no brush signal.