随笔分类 -  PyQt5-图形界面编程

摘要:在计算机应用程序中,对话框是用户与应用程序交互的窗口。对话框用于输入数据,修改数据,修改应用程序设置等。 import sys from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, QPushButton, QLabel, Q 阅读全文
posted @ 2020-01-17 17:17 PIPO2 阅读(886) 评论(0) 推荐(0)
摘要:复选框被选中或者取消选中,都会发射一个stateChanged()信号。可以使用 isChecked()来查询复选框是否被选中。 import sys from PyQt5.QtWidgets import QApplication, QWidget, QCheckBox, QLabel, QHBo 阅读全文
posted @ 2020-01-17 16:12 PIPO2 阅读(11756) 评论(0) 推荐(1)
摘要:QRadioButton是一个单选按钮,可以打开(选中)或关闭(取消选中)。在一组单选按钮中,一次只能选中其中一个按钮。 打开或关闭按钮,都会发出toggled()信号。使用isChecked()可以查看是否选择了一个特定的按钮。 import sys from PyQt5.QtWidgets im 阅读全文
posted @ 2020-01-17 15:21 PIPO2 阅读(2268) 评论(0) 推荐(0)
摘要:普通按钮(QPushButton) import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton from PyQt5.QtCore import QTimer class Example(QWidget): de 阅读全文
posted @ 2020-01-17 14:23 PIPO2 阅读(1311) 评论(1) 推荐(0)
摘要:箱式布局(BoxLayout) 我们使用QHBoxLayout和QVBoxLayout,来分别创建水平布局和垂直布局。 import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout, QV 阅读全文
posted @ 2020-01-17 10:50 PIPO2 阅读(240) 评论(0) 推荐(0)
摘要:单行文本输入框(QLineEdit) import sys from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit, QLabel class Example(QWidget): def __init__(self): super() 阅读全文
posted @ 2020-01-16 14:03 PIPO2 阅读(2578) 评论(0) 推荐(0)
摘要:QMessageBox类提供了一个消息对话框,用于通知用户或询问用户问题并接收答案。 消息对话框分为五种,分别是information,question,warning,critical,abort。 import sys from PyQt5.QtWidgets import QApplicati 阅读全文
posted @ 2020-01-16 10:14 PIPO2 阅读(899) 评论(0) 推荐(0)
摘要:所有的GUI程序都是事件驱动的,事件主要由用户触发,也可能是程序触发。 PyQt5有一个独特的signal&slot(信号槽)机制来处理事件。信号槽用于对象间的通信。signal在某一特定事件发生时被触发,slot可以是任何callable对象。当signal触发时会调用与之相连的slot。 通用表 阅读全文
posted @ 2020-01-16 10:11 PIPO2 阅读(267) 评论(0) 推荐(0)
摘要:PyQt5是一个可用于创建图形用户界面(GUI)的模块,使用前要先进行安装 pip install PyQt5==5.12。需要Python 2.6或更高版本。 简单窗口 import sys # QtWidgets模块包含了一套创建桌面应用的UI元素组件 from PyQt5.QtWidgets 阅读全文
posted @ 2020-01-15 15:16 PIPO2 阅读(240) 评论(0) 推荐(0)