self.setWindowFlags(Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint) 其中Qt是通过PyQt5.QtCore导入。 效果如下: