首页 > 编程语言 > 详细

python PyQt5学习笔记1

时间:2018-01-14 22:11:06      阅读:266      评论:0      收藏:0      [点我收藏+]

PyQt4 和 PyQt5 的不同之处

The PyQt5 is not backward compatible with PyQt4; there are several significant changes in PyQt5. However, it is not very difficult to adjust older code to the new library. The differences are, among others, the following:

PyQt5不向后兼容PyQt4;这是一些在PyQt5中的重要改变。然而,将旧代码迁移到新的版本中并不是非常困难。不同点如下:

  • Python 模块已经被改写. 一些模块被舍弃 (QtScript), 部分的模块被分割成子模块 (QtGuiQtWebKit).
  • 新的模块被引进, 包含 QtBluetoothQtPositioning, 和 Enginio.
  • PyQt5 只支持最新风格的信号和槽的写法. SIGNAL()和SLOT()的调用将不会被长时间支持.
  • PyQt5 不支持任何在Qt 5.0版本中弃用或取消的API.

例子: 空白窗口

 1 import sys
 2 from PyQt5.QtWidgets import QApplication, QWidget
 3 
 4 
 5 if __name__ == __main__:
 6     
 7     app = QApplication(sys.argv)
 8 
 9     w = QWidget()
10     w.resize(250, 150)
11     w.move(300, 300)
12     w.setWindowTitle(Simple)
13     w.show()
14     
15     sys.exit(app.exec_())

结果:

技术分享图片

python PyQt5学习笔记1

原文:https://www.cnblogs.com/hackpig/p/8284431.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!