[PyQt] Drawing on desktop (root window) under X11

Maurizio Berti maurizio.berti at gmail.com
Wed Jul 24 03:45:52 BST 2019


Il giorno mar 23 lug 2019 alle ore 12:00 David Boddie <david at boddie.org.uk>
ha scritto:

> The documentation about drawing on the desktop is very old - from Qt 3, if
> not earlier. I remember trying to draw on the desktop with Qt 4 (and maybe
> even Qt 3) using similar techniques but didn't manage to make it work.
> I would be very surprised if any modern desktop would allow this to be
> done.
>

I thought the same thing, but I decided to give it a try anyway.

Plus, the painting model changed in Qt 4 to disallow (or deprecate) painting
> on widgets from outside of paint event handlers, so some of the tricks used
> in the old Qt 3 example won't work now.
>

Indeed. Also, QDesktopWidget is obsolete for Qt5.
I tried to send a QPaintEvent to QApplication, but got this:

StdErr: QWidget::paintEngine: Should no longer be called
QPainter::begin: Paint device returned engine == 0, type: 1


The same happens if I try to send that event to a new QWidget with
Qt.Desktop
set as windowFlag (which doesn't call the paintEvent itself anyway).
Creating a new QWidget with the QDesktopWidget as a parent doesn't work
either.

I seem to remember that it was (is?) possible to do it using Gtk along with
Cairo,
but that was more than 5 years ago.

Does anyone know if it's possible to draw on the root window on X11 via Qt
or,
at least, Python?

Thanks,
Maurizio

-- 
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190724/268b7614/attachment.html>


More information about the PyQt mailing list