Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PySide2 (Qt with Python) doesn't detect compositing (X11 and Compton) - No transparency
Forum Updated to NodeBB v4.3 + New Features

PySide2 (Qt with Python) doesn't detect compositing (X11 and Compton) - No transparency

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 355 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    python1212
    wrote on last edited by
    #1

    My script uses PySide2 to use Qt in Python. The script requires transparency (can see desktop behind window).

    I use Ubuntu with X11, LXQT and Compton. Also tested with LXDE and XFCE without success. Transparency works for regular windows like browser and text editor, but not for my python script.

    Transparency is set via background: url(bg_with_transparency.png) but I also tested with rgba color and w.setWindowOpacity(0.5) without success.

    Following flags are set: (Window must also be click-through)

    w.setWindowFlags(w.windowFlags() |
        QtCore.Qt.WindowTransparentForInput |
        QtCore.Qt.X11BypassWindowManagerHint |
        QtCore.Qt.WindowStaysOnTopHint |
        QtCore.Qt.FramelessWindowHint)
    w.setAttribute(QtCore.Qt.WA_TranslucentBackground)
    w.setAttribute(QtCore.Qt.WA_NoSystemBackground)
    

    Without WA_TranslucentBackground and WA_NoSystemBackground the image displays with a black background instead of transparency. When I enabled these flags without compositing, the window displayed pure black. After I enable Compton, the window does not display at all (no error) and QtX11Extras.QX11Info.isCompositingManagerRunning() returns false.

    How to fix this? I prefer to use PySide2 and Python but I am open to other GUIs or programming languages, as long as the script works with Ubuntu and has following features:

    • Transparency (background is PNG with rgba)
    • Click through capability
    • Always on top

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you also try that with PyQt5 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved