pyqt5调用messagebox程序就异常停止
def closeEvent(self, event):if self.is_change_user:
reply = QMessageBox.question(self, '消息', '确定退出当前账号吗?',
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
else:
reply = QMessageBox.question(self, '消息', '确定退出系统吗?',
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes:
event.accept()
if self.is_change_user:
self.login_win.show()
else:
event.ignore()
self.is_change_user = False
在pycharm中QMessageBox.question(self)中的self下打了波浪线显示Expected type 'QMessageBox', got 'MainWindow' instead
Inspection info: This inspection detects type errors in function call expressions. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Types of function parameters can be specified in docstrings or in Python 3 function annotations.程序一触发QMessage就异样卡住了是咋回事 本帖最后由 hrp 于 2020-11-27 07:26 编辑
没有完整代码不好判断。
页:
[1]