-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathovcovac.py
65 lines (49 loc) · 1.65 KB
/
ovcovac.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import random
from PyQt5.QtWidgets import QWidget, QApplication, QMainWindow
from PyQt5.QtGui import QPainter, QColor, QBrush
from PyQt5.QtCore import Qt, QTimer
class Ovcovac(QMainWindow):
def __init__(self, app=None):
super().__init__()
self.app = app
self.setAttribute(Qt.WA_NoSystemBackground, True)
self.setAttribute(Qt.WA_TranslucentBackground, True)
self.setWindowFlags(Qt.WindowStaysOnTopHint |
Qt.FramelessWindowHint |
Qt.X11BypassWindowManagerHint)
self.initUI()
timer = QTimer(self)
timer.timeout.connect(self.update)
timer.setInterval(1000)
timer.start()
def initUI(self):
self.showMaximized()
self.showFullScreen()
self.setWindowTitle('Ovce')
geometry = app.desktop().availableGeometry()
geometry.setHeight(geometry.height())
self.setGeometry(geometry)
self.show()
def paintEvent(self, e):
qp = QPainter()
qp.begin(self)
self.drawRectangles(qp)
qp.end()
def drawRectangles(self, qp):
x = random.randint(0, 200)
col = QColor(0, 0, 0)
col.setNamedColor('#d4d4d4')
qp.setPen(col)
qp.setBrush(QColor(200, 0, 0))
qp.drawRect(10+x, 15+x, 90, 60)
qp.setBrush(QColor(255, 80, 0, 160))
qp.drawRect(130+x, 15+x, 90, 60)
qp.setBrush(QColor(25, 0, 90, 200))
qp.drawRect(250+x, 15+x, 90, 60)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Ovcovac()
sys.exit(app.exec_())