Setting a transparent main window

pyqt, python, qt

Solution

you must set new attribute for MainWindow object as below:

class Main(QtGui.QMainWindow):
      def __init__(self):
          self.setAttribute(Qt.WA_TranslucentBackground)

Problem

How to set main window background transparent on QT? Do I need an attribute or a style? I've tried setting the opacity, but it didn't work for me. ``` app.setStyleSheet("QMainWindow {opacity:0}") ```

Original source