Setting the transparent main window

How to adjust the transparency of the main window on QT? Do I need an attribute or style?
I tried to set the opacity, but it did not work for me.

app.setStyleSheet("QMainWindow {opacity:0}")
+5
source share
2 answers

you must set a new attribute for the MainWindow object, as shown below:

class Main(QtGui.QMainWindow):
      def __init__(self):
          self.setAttribute(Qt.WA_TranslucentBackground)
+9
source
0
source

All Articles