1

I've been working on a screenshot application written in Python (v. 3.5) using PyQt5 (v 5.7), but I've been developing it on MacOs. The app works as intended on Mac, but when I pulled the repo onto my Windows 10 machine I can't get the app to render properly.

Basically I want a fullscreen transparent window, here's the code I am using. As it is, nothing renders at all. (Qt is imported from QtCore)

    self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
    self.setAttribute(Qt.WA_TranslucentBackground)
#Maximize the window
    self.showFullScreen()
#Render the window
    self.activateWindow()
    self.setFocus()
    self.show()

When I comment out self.setAttribute(Qt.WA_TranslucentBackground) it will actually render (but with the gray-ish background).

I've tried removing self.windowFlags() from setWindowFlags() to no avail (as seen in this answer).

Also tried it without self.setFocus() and self.activateWindow()

Is this a bug? or am I doing something wrong here.

Any help would be appreciated.

Community
  • 1
  • 1
Kalob Porter
  • 440
  • 3
  • 12
  • Try using `self.setWindowOpacity(0.5)` instead of `self.setAttribute(Qt.WA_TranslucentBackground)` and adjust your opacity wanted. You can look [here](http://stackoverflow.com/questions/37530276/transparent-widgets-inside-transparent-frame-pyqt5) for more details. From what I understand you want full background transparent and visible widgets ? – syedelec Dec 05 '16 at 19:45

1 Answers1

0

Try using the windowOpacity prop or method setWindowOpacity(double)

http://doc.qt.io/qt-5/qwidget.html#windowOpacity-prop

J Livengood
  • 2,729
  • 1
  • 12
  • 26