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.
Try using the windowOpacity
prop or method setWindowOpacity(double)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.