DeprecationWarning: sipPyTypeDict() is deprecated, the extension module should use sipPyTypeDictRef() instead class MyWindow(QWidget):
安装PyQt6,提示消失。各处也运行正常。
如下代码,按Esc键关闭窗口,在PyQt5中,按任意键均关闭。
import sys
from PyQt6.QtWidgets import QApplication, QLabel, QWidget, QHBoxLayout
from PyQt6.QtGui import QIcon, QFont
from PyQt6.QtCore import Qt
class MyWindow(QWidget):
"""从QWidget类派生的桌面应用程序窗口类"""
def __init__(self):
"""构造函数"""
super().__init__() # 调用基类的构造函数
self.setWindowTitle('事件和事件函数')
self.setGeometry(400, 300, 320, 80)
self.setWindowIcon(QIcon('res/Folder lila.ico'))
self.initUI()
self.show()
def initUI(self):
"""初始化界面"""
lab = QLabel('按Esc键关闭窗口')
box = QHBoxLayout()
box.addS