当前位置:网站首页>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_())边栏推荐
猜你喜欢

Security Thought Project Summary

Test automation selenium (a)

MFCC转音频,效果不要太逗>V<!

Re20:读论文的先例:普通法的信息理论分析

BERT pre-training model series summary

多线程--线程和线程池的用法

新一代开源免费的终端工具,太酷了

Redis Desktop Manager 2022.4.2 发布

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

leetcode 剑指 Offer 22. 链表中倒数第k个节点
随机推荐
MySQL installation tutorial [installation version]
OC-手动引用计数内存管理
105. 从前序与中序遍历序列构造二叉树(视频讲解!!)
Flink_CDC construction and simple use
EViews 12.0 software installation package download and installation tutorial
Domino服务器SSL证书安装指南
Meikle Studio-Look at the actual combat notes of Hongmeng device development six-wireless networking development
梅科尔工作室-看鸿蒙设备开发实战笔记五——驱动子系统开发
在机器人行业的专业人士眼里,机器人行业目前的情况如何?
PyQt5-用像素点绘制正弦曲线
Mysterious APT Attack
hcip06 ospf special area comprehensive experiment
你真的懂Redis的5种基本数据结构吗?
Re15:读论文 LEVEN: A Large-Scale Chinese Legal Event Detection Dataset
Multithreading--the usage of threads and thread pools
Re15: Read the paper LEVEN: A Large-Scale Chinese Legal Event Detection Dataset
Version management of public Jar packages
[100个Solidity使用技巧]1、合约重入攻击
STM32CubeMX配置生成FreeRTOS项目
水电表预付费系统