Print statements? Console? (first plug-in)

I’m trying to develop my first extension. I’m just using VS Code as my text editor and I’ve created all the files for the extension (.desktop, .action etc). I got the plug-in to show up and I’m able to run it from the Scripts tab. I’ve been getting various errors and saw what the problems were and worked through them. At this point, though, it’s not saying anything when I run the script. I’m trying to figure out what’s going on, so I added a print statement at a point in my code. However, I don’t know how to see the result of the print statement after running the code in Krita.

I only have minimal experience coding. In Blender I could see print statements in the Python Console. Is there anything similar in Krita?


It will depend.

If your script is running in Scripter, you should see print() output in scripter.
Except if your script is executing a non modal QDialog for example (because of execution in a separate thread…)

If your script is running in a docker or is executed from Krita’s menu, print() statement are visible in console if you’ve executed Krita from a command line.
Except if you’re working on windows.
CMD console or Powershell console won’t display anything: in windows you have to type your Krita’s command line from a console like cygwin to be able to get output console


Do you mean I have to run Krita from this cygwin, or I have to do all my coding there? Thanks.

There’s also the log docker that shows anything printed to the console. That’s probably the easiest option on Windows; another option is DebugView - Windows Sysinternals | Microsoft Docs

Cygwin is just a console (a bash console) executed on windows, like CMD or POWERSHELL console.
Just execute Krita from command line; coded script is executed from Krita.

I’ve to check to take a look closer on this, I’m so used to work with console :slight_smile:

I have to test that :slight_smile:


The main thing to be aware of is that if the log docker is enabled, even if it isn’t visible, all output goes there. Naming no names, there are plenty krita developers who enabled the log docker, then forgot about it, then tried to debug Qt to figure out why there was no output on the console anymore :slight_smile:

1 Like

I can’t seem to get anything to print in the log docker, unfortunately. Everything is enabled in the Log Settings. Here’s my extension that I made specifically to test printing…

from krita import Extension

class PrintStuff(Extension):
    def __init__(self, parent):

    def setup(self):

    def printstuff(self):
        print('Print Stuff!')

    def createActions(self, window):
        action = window.createAction("printstuff", "Print Stuff")


and my file:

from .printstuff import *


The Log Viewer doesn’t do anything when I click this or hit the shortcut that comes from the action file…

well what I have been using is one of 3 things depending on the case:

  1. sending the message to a label widget

  2. creating a popup message into view
    QMessageBox.information(QWidget(), i18n("Warnning"), i18n("message"))

  3. Log viewer message


or just guessing as I did before any of this :sob:

1 Like

Yeah I started using message boxes as well. Thanks! I’ll try the other options as well.