PyQT5

Layout management is the way how we place the widgets on the application window 布局管理是我们在应用程序窗口上放置小部件的方式

放小部件的时候,可以基于绝对位置,也可以用布局类

基本的布局类

  • QHBoxLayout
  • QVBoxLayout

事件(Events)和信号(Signals):

GUI 系统是事件驱动的,事件主要由应用的用户产生的,也可以由其它方式产生, 如网络联接,计时器

exec_()

事件模型中有 3 个参与者:

  • 事件源:状态改变的对象,它产生了事件
  • 事件对象:封装了事件源的状态改变
  • 事件目标:想被修改的对象

PyQt5 has a unique signal and slot mechanism to deal with events. Signals and slots are used for communication between objects. A signal is emitted when a particular event occurs. A slot can be any Python callable. A slot is called when its connected signal is emitted.

sender 是发送信号的对象 receiver 是接收信号的对象 slot 是对信号做出反应的方法

Stretch factor: 小部件放置的间隔

QtCore

非 GUI 的功能核心,如处理时间、文件和目录等内容。

QtGui

用于窗口系统集成的类

QtWidgets

包含 UI 元素的集合用于创建经典的桌面界面

QtMultimedia

用于处理多媒体内容的类 用于访问相机和音频功能的 APIs

QtBluetooth

包含用于扫描设备及与设备联接和交互类。

QtNetwork

网络编程

QtPositioning

包含的类主要用于定位,用卫星、Wi-Fi、或者文本。

QtWebSockets

实现了 WebSocket 协议

QtWebEngine

integrating QML Web Engine objects with Python The QtWebEngineCore contains the core Web Engine classes

QtWebEngineWidgets

基于 Chromium 的网络浏览器

QtXml

用于处理 XML 文件的类

QtSvg

显示 Svg 文件内容

Scalable Vector Graphics (SVG) 是用 XML 描述二维图形及图形应用的语言。

QtSql

数据库

参考资料

[1] https://zetcode.com/gui/pyqt5/introduction/

results matching ""

    No results matching ""