试试吧:
from PyQt5.QtCore import Qt, QSize, QTimer
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QWidget,
QPushButton, QGridLayout, QSpacerItem,
QSizePolicy, QLabel, QApplication)
class Dialog(QDialog):
def __init__(self, *args, **kwargs):
super(Dialog, self).__init__(*args, **kwargs)
self.setObjectName('Custom_Dialog')
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
self.setAttribute(Qt.WA_TranslucentBackground, True)
self.setStyleSheet(Stylesheet)
self.initUi()
def initUi(self):
# Important: this widget is used as background and rounded corners.
self.widget = QWidget(self)
self.widget.setObjectName('Custom_Widget')
layout = QVBoxLayout(self)
layout.addWidget(self.widget)
# Add user interface to widget