当前位置:网站首页>PyQt5 - Drawing different types of straight lines
PyQt5 - Drawing different types of straight lines
2022-07-30 10:14:00 【Zhuangluo orange】
The effect is as follows:

The code is as follows:
'''Draw different types of straight lines'''import sys,mathfrom PyQt5.QtWidgets import *from PyQt5.QtGui import *from PyQt5.QtCore import Qtclass DrawMultiLine(QWidget):def __init__(self):super(DrawMultiLine,self).__init__()self.resize(300,300)self.setWindowTitle('Set Pen's style')def paintEvent(self, event):painter = QPainter()painter.begin(self)pen = QPen(Qt.red,3,Qt.SolidLine)painter.setPen(pen)painter.drawLine(20,40,250,40)pen.setStyle(Qt.DashLine)painter.setPen(pen)painter.drawLine(20, 80, 250, 80)pen.setStyle(Qt.DashDotDotLine)painter.setPen(pen)painter.drawLine(20, 120, 250, 120)pen.setStyle(Qt.DotLine)painter.setPen(pen)painter.drawLine(20, 160, 250, 160)pen.setStyle(Qt.DashDotDotLine)painter.setPen(pen)painter.drawLine(20, 200, 250, 200)pen.setStyle(Qt.CustomDashLine)pen.setDashPattern([1,10,5,8])painter.setPen(pen)painter.drawLine(20, 240, 250, 240)size = self.size()painter.end()if __name__ == '__main__':app = QApplication(sys.argv)main = DrawMultiLine()main.show()sys.exit(app.exec_())边栏推荐
- 最长公共序列、串问题总结
- leetcode 剑指 Offer 58 - I. 翻转单词顺序
- Version management of public Jar packages
- Security Thought Project Summary
- Shell系统学习之数组
- PyQt5-绘制不同类型的直线
- Beijing suddenly announced big news in the Metaverse
- Re19: Read the paper Paragraph-level Rationale Extraction through Regularization: A case study on European Court
- PyQt5 - draw sine curve with pixels
- Re16: Read the paper ILDC for CJPE: Indian Legal Documents Corpus for Court Judgment Prediction and Explanation
猜你喜欢

A new generation of free open source terminal tool, so cool

Flink_CDC construction and simple use

In the robot industry professionals, Mr Robot industry current situation?

HR团队如何提升效率?人力资源RPA给你答案

By building a sequence table - teach you to calculate time complexity and space complexity (including recursion)

hcip06 ospf特殊区域综合实验

BERT pre-training model series summary

JCL 学习

(Text) Frameless button settings

Meikle Studio - see the actual combat notes of Hongmeng device development 4 - kernel development
随机推荐
leetcode 剑指 Offer 21. 调整数组顺序使奇数位于偶数前面
连接mysql报错WARN: Establishing SSL connection without server‘s identity verification is not recommended
ospf2双点双向重发布(题2)
Soft Exam System Architect Concise Tutorial | Case Analysis | Requirement Analysis
flowable工作流所有业务概念
Redis Desktop Manager 2022.4.2 发布
软考 系统架构设计师 简明教程 | 案例分析 | 需求分析
CVTE校招笔试题+知识点总结
spark udf 接受并处理 null值.
OC-ARC(Automatic Reference Counting)自动引用计数
Determine whether a tree is a complete binary tree - video explanation!!!
606. 根据二叉树创建字符串(视频讲解!!!)
再有人问你分布式事务,把这篇扔给他
ospf2 two-point two-way republish (question 2)
Security思想项目总结
(C语言)文件操作
JCL 学习
Beijing suddenly announced big news in the Metaverse
HR团队如何提升效率?人力资源RPA给你答案
Basic operations of sequence table in C language