commit
73385bb33e
@ -0,0 +1,3 @@ |
||||
[submodule "gex-client-py"] |
||||
path = gex-client-py |
||||
url = https://git.ondrovo.com/gex/gex-client-py.git |
@ -0,0 +1 @@ |
||||
Subproject commit 3a5ac05d9db965f86188929f8f56a68ee994827d |
@ -0,0 +1,52 @@ |
||||
from PyQt4 import QtCore, QtGui, Qt |
||||
from PyQt4.QtGui import QApplication, QMainWindow |
||||
import sys, math |
||||
|
||||
class MyMainScreen(QMainWindow): |
||||
def __init__(self, parent=None): |
||||
QtGui.QMainWindow.__init__(self, parent) |
||||
|
||||
self.timer = QtCore.QTimer(self) |
||||
self.timer.setInterval(100) |
||||
self.timer.timeout.connect(self.blink) |
||||
self.timer.start() |
||||
|
||||
self.resize(500, 500) |
||||
self.centralwidget = QtGui.QWidget(self) |
||||
self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget) |
||||
|
||||
self.setCentralWidget(self.centralwidget) |
||||
self.menubar = QtGui.QMenuBar(self) |
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 22)) |
||||
|
||||
self.setMenuBar(self.menubar) |
||||
|
||||
self.statusbar = QtGui.QStatusBar(self) |
||||
self.setStatusBar(self.statusbar) |
||||
QtCore.QMetaObject.connectSlotsByName(self) |
||||
|
||||
self.n = 0 |
||||
|
||||
def blink(self): |
||||
self.n += 0.1 |
||||
self.n = self.n % 20 |
||||
self.repaint() |
||||
|
||||
def paintEvent(self, event): |
||||
painter = QtGui.QPainter(self) |
||||
painter.setRenderHint(QtGui.QPainter.Antialiasing) |
||||
painter.setRenderHint(QtGui.QPainter.HighQualityAntialiasing) |
||||
painter.setPen(QtGui.QPen(QtCore.Qt.red, 2)) |
||||
|
||||
step = 2 |
||||
amp = (self.height()/2)*0.8 |
||||
for i in range(0, self.width(), step): |
||||
y0 = round(self.height()/2 + amp * math.sin(2*math.pi*self.n*(i/180))) |
||||
y1 = round(self.height()/2 + amp * math.sin(2*math.pi*self.n*((i+step)/180))) |
||||
painter.drawLine(QtCore.QLine(i, y0, i+step, y1)) |
||||
|
||||
if __name__ == "__main__": |
||||
app = QApplication(sys.argv) |
||||
mainscreen = MyMainScreen() |
||||
mainscreen.show() |
||||
app.exec_() |
Loading…
Reference in new issue