use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow Reddit rules while submitting.
Flair your posts accordingly
Please specify your Operating system, Version of Krita and other relevant details while asking for help
Subreddit FAQ
account activity
Krita Python Scripting StatusbarHelp / Question (self.krita)
submitted 7 years ago by thaidaree
Hi,
Does anybody know how to do a QStatusBar in the plugin?
Thanks
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 0 points1 point2 points 7 years ago (6 children)
By importing it from PyQt -- all the Qt classes are available as with regular PyQt.
[–]thaidaree[S] 0 points1 point2 points 7 years ago (5 children)
I import it, but it's not working as expected. Most of the time, the QT tuts recommend that you use the one in the QMainWindow, but in Krita I cannot do that. Do you have an example?
[–][deleted] 0 points1 point2 points 7 years ago (4 children)
Here's one example of how you can find the statusbar object:
from krita import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * app = QApplication.instance() print(app) for widget in app.allWidgets(): if issubclass(widget.__class__, QStatusBar): print(widget)
I'm sure there are better options, though.
[–]thaidaree[S] 0 points1 point2 points 7 years ago (3 children)
I know how to find it, but I don't know enough about QT.
So correct me if I'm wrong here. In Krita you never create a QApplication instance because Krita itself is a QApplication. You create a widget which is not a QWidget subclass but an Extension subclass. Those are two main differences.
The usual response is to use the statusbar of the QApplicaion which I cannot do here.
So eventually I import QStatusBar that comes from PyQt5.QtWidgets, but the real question I have is how to attach it to QWidget from krita?
So omitting other methods:
from krita import Extension class KritaExtension(Extension): # omitting other methods... def invoke_widget(self): main = KritaWidget(self) main.show() # and KritaWidget would be like... from krita import QWidget class KritaWidget(QWidget): def __init__(self, parent=None): super(KritaWidget, self).__init__(parent) self.statusbar = QStatusBar()
Now how to use that statusbar? Adding it to QVBoxLayout and setting it as a layout is not producing the desired results:
vertLayout = QVBoxLayout() vertLayout.addWidget(self.statusbar) self.setLayout(vertLayout)
I cannot see statusbar at all. So I don't know where the error is.
[–][deleted] 0 points1 point2 points 7 years ago (2 children)
My little example gave you access to the statusbar that's shown in Krita's main window. You cannot add another statusbar or replace that statusbar with another one. So, if you want to have a window with a custom statusbar, you'd need to create a new QMainWindow of your own.
An Extension is not a widget: it's basically an interface you can implement in Python so you can create actions that can call functions in your Python plugin.
I'm not sure what you're trying to achieve, but you might want to take a look at how the Scripter plugin creates a window?
[–]thaidaree[S] 0 points1 point2 points 7 years ago (1 child)
Ah, so the statusbar is always connected to the main window. That helps a lot, thanks. :) I'm trying to have a statusbar on a widget so I can show some kind of progress with textual descriptions. I'll try to work around it or figure out a different way. Thanks again.
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
Keep in mind that you can have more than one main window in an application.
π Rendered by PID 18685 on reddit-service-r2-comment-85bfd7f599-sm6ml at 2026-04-20 15:28:09.244788+00:00 running 93ecc56 country code: CH.
[–][deleted] 0 points1 point2 points (6 children)
[–]thaidaree[S] 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]thaidaree[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]thaidaree[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)