![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PyQt5
我以为你是流过泪的人
这个作者很懒,什么都没留下…
展开
-
PyQt5 在输入框 LineEdit 中添加点击事件
需求背景在用PyQt5做图形界面开发时,需要在输入框的最右边添加一个按钮,比如确认键实现方法本篇文章使用QAction来实现,原理为QAction触发一个行为,绑定触发该行为后的槽函数。下面直接上代码import sysfrom PyQt5.QtCore import Qtfrom PyQt5.QtWidgets import QWidget, QApplication, \ QAction, QLineEdit, QFormLayout, QHBoxLayout, QPushBut原创 2021-01-30 14:48:59 · 3687 阅读 · 0 评论 -
PyQt5 在按钮上添加图片
在用Python(PyQt5)做图形界面开发时,如果我们要手动实现一个带有刷新图标的按钮时,那么就要用到在按钮上添加图片的功能,下面将直接介绍实现方法:方法一、为按钮添加样式setStyleSheet设置background-imagebutton = QPushButton()img_path = '' # 图片路径button.setStyleSheet("QPushButton{\n""background-image: url(\"%s\");\n""background-posi原创 2021-01-30 11:42:06 · 7653 阅读 · 2 评论