资源简介
用PyQT5+按钮事件绘制图形,做了绘制圆形和矩形的demo。
代码片段和文件信息
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file ‘C:\Users\Brent\Desktop\MainWindowAdvanced.ui‘
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!
import sys
from PyQt5.QtWidgets import QApplication QWidget QPushButton
from PyQt5.QtGui import QPainter QColor QPen
from PyQt5.QtCore import pyqtSlot Qt
class App(QWidget):
def __init__(self):
super().__init__()
self.title = “PyQt5 button“
self.left = 100
self.top = 100
self.width = 1000
self.height = 1000
self.draw = ““
self.initUI()
def initUI(self):
self.setWindowtitle(self.title)
self.setGeometry(self.left self.top self.width self.height)
“““在窗体内创建button对象“““
button = QPushButton(“Circle“ self)
“““方法setToolTip在用户将鼠标停留在按钮上时显示的消息“““
button.setToolTip(“This is an example button“)
“““按钮坐标x = 100 y = 70“““
button.move(200 200)
button.resize(button.sizeHint())
“““按钮与鼠标点击事件相关联“““
button.clicked.connect(self.circle)
button1 = QPushButton(“Rectangle“ self)
“““方法setToolTip在用户将鼠标停留在按钮上时显示的消息“““
button1.setToolTip(“This is an example button“)
“““按钮坐标x = 100 y = 70“““
相关资源
- python+pyqt5+百度AI+车牌识别.rar
- Python3.x+Pyqt5实现界面编程浏览网页
- Python-用pyqt5和parametrics实现很酷的动画
- PyQt5 Python 桌面应用程序源码.zip
- python pyqt5 计时器源代码
- pyqt5_python_Gui入门教程.docx
- 利用摄像头拍照并保存照片程序pyth
- QT5 Python GUI Programming Cookbook - 2018
- Python3.4 PyQt5 32位安装版PyQt5-5.5.1-gpl-
- PyQt5 5.3.2 gpl Py3.4 Qt5.3.1 x32.exe
- PyQt5-5.12-5.12.1_a-cp35.cp36.cp37.cp38-none-w
- Serial assistant.rar
- PyQt5快速开发与实战pdf+源码.zip
- 创建画板,手写体实时在线识别
- PyQt5_Tools-5.7.dev1-py3-none-any.whl
- PyQt5快速开发与实战.zip
- PyQt5-5.4-gpl-Py3.4-Qt5.4.0-x64
- Python + PyQt5 + MySQL模拟QQ的聊天与娱乐
- 创建画板,实时在线手写体识别
- PyQt5-5.5.1-gpl-Py3.4-Qt5.5.1-x32
- pyqt5实现自动获取IP软件
- python-vlc二次封装,可用于pyqt
- tesseract V2.0()
- python聊天室---pyqt5+socket+Thread聊天室
-
PyQ5 Mtaplotlib Datafr
ame画一条随鼠标移 - python实时读取串口数据并自动保存至
- pyqt5做一个一个时钟demo(python3)
-
pyQt5_wavepla
yer python计算声音分贝 语 - 实现小学三年级口算题生成器
- 续Python3.x+Pyqt5实现主窗体里QToolBox导航
评论
共有 条评论