问题
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}")
回答1:
you must set new attribute for MainWindow object as below:
class Main(QtGui.QMainWindow):
def __init__(self):
self.setAttribute(Qt.WA_TranslucentBackground)
回答2:
Just use the windowOpacity property:
http://doc.qt.io/qt-4.8/qwidget.html#windowOpacity-prop
来源:https://stackoverflow.com/questions/14943142/setting-a-transparent-main-window