-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemoo.py
44 lines (33 loc) · 987 Bytes
/
demoo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@Author Fivethousand
@Date 2021/3/27 20:02
@Describe
@Version 1.0
"""
import sys
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
class Widget(QWidget):
def __init__(self):
super().__init__()
def paintEvent(self, event):
painter = QPainter(self)
painter.setPen(Qt.red)
painter.drawLine(10, 10, 100, 140)
painter.setPen(Qt.blue)
painter.drawRect(120, 10, 80, 80)
rectf = QRectF(230.0, 10.0, 80.0, 80.0)
painter.drawRoundedRect(rectf, 20, 20)
p1 = [QPoint(10, 100), QPoint(220, 110), QPoint(220, 190)]
painter.drawPolyline(QPolygon(p1))
p2 = [QPoint(120, 110), QPoint(220, 110), QPoint(220, 190)]
painter.drawPolygon(QPolygon(p2))
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Widget()
ex.resize(400, 280)
ex.show()
sys.exit(app.exec_())