Python 如何取消pyqt5中的透明?

Python 如何取消pyqt5中的透明?,python,pyqt5,Python,Pyqt5,我发现如果我使用 widget.setAttribute(Qt.WA_TranslucentBackground) 然后,上面的任何videoWidget都不会显示任何东西,如果我不设置这个属性,videoWidget将显示得很好。所以我想我可以设置单个videoWidget cancel Transparent来解决这个问题,或者使用任何其他方法来保持主窗口透明并在其上显示视频吗 顺便说一句,这些方法无法恢复set transparent之前的小部件状态 self.setAttrib

我发现如果我使用

widget.setAttribute(Qt.WA_TranslucentBackground)
然后,上面的任何videoWidget都不会显示任何东西,如果我不设置这个属性,videoWidget将显示得很好。所以我想我可以设置单个videoWidget cancel Transparent来解决这个问题,或者使用任何其他方法来保持主窗口透明并在其上显示视频吗

顺便说一句,这些方法无法恢复set transparent之前的小部件状态

    self.setAttribute(Qt.WA_TranslucentBackground)
    self.setAttribute(Qt.WA_StyledBackground)
    self.setAttribute(Qt.WA_TintedBackground)
    self.setAttribute(Qt.WA_NoSystemBackground)

众所周知,透明性在PyQt上的QVideoWidget上存在问题,您实际需要透明性做什么?作为另一种选择,考虑使用QGraceCsWIDGET。