资源简介
PYQT5写字板
需要先安装pyqt5,打开cmd,输入pip install pyqt5
代码片段和文件信息
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# filename:PyQt5写字板.py
import sys
from PyQt5.QtWidgets import (QApplication QWidget)
from PyQt5.QtGui import (QPainter QPenQIcon)
from PyQt5.QtCore import Qt
class Example(QWidget):
def __init__(self):
super(Example self).__init__()
self.resize(960540)
self.move(100 100)
self.setWindowtitle(“PyQt5写字板“)
self.setWindowIcon(QIcon(‘ico.ico‘))
self.setMouseTracking(False)
self.pos_xy = []
def paintEvent(self event):
painter = QPainter()
painter.begin(self)
pen = QPen(Qt.black2Qt.SolidLine)
painter.setPen(pen)
if len(self.pos_xy) > 1:
point_start = self.pos_xy[0]
for pos_tmp in self.pos_xy:
point_end
- 上一篇:tkinter答题系统源码
- 下一篇:Python:发送带图片邮件
评论
共有 条评论