summaryrefslogtreecommitdiffstats
path: root/examples3/aclock.py
diff options
context:
space:
mode:
authoraneejit1 <aneejit1@gmail.com>2022-07-28 15:46:19 +0000
committerSlávek Banko <slavek.banko@axis.cz>2022-07-31 16:41:03 +0200
commit4978511ebb7e8d31dab64485d1ac87b6e004be81 (patch)
treea2da3161f070116baa15de7276c5c0c9ac855e8f /examples3/aclock.py
parent5916692cf4c4df4f808e346c9bda1604960a0ff3 (diff)
downloadpytqt-4978511ebb7e8d31dab64485d1ac87b6e004be81.tar.gz
pytqt-4978511ebb7e8d31dab64485d1ac87b6e004be81.zip
Remove Qt V2 support and example files
Build files for pyuic2 have been removed along with the examples for version 2 of Qt and the build/configure scripts have been amended accordingly. The "examples3" directory has been renamed to just "examples". Signed-off-by: aneejit1 <aneejit1@gmail.com> (cherry picked from commit e602246539fd7435aaeb440fcb7f852c92c8426b)
Diffstat (limited to 'examples3/aclock.py')
-rwxr-xr-xexamples3/aclock.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/examples3/aclock.py b/examples3/aclock.py
deleted file mode 100755
index 66283ef..0000000
--- a/examples3/aclock.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-from python_tqt.qt import *
-
-def TQMIN(x, y):
- if y > x: return y
- return x
-class AnalogClock(TQWidget):
- def __init__(self, *args):
- TQWidget.__init__(*(self,) + args)
- self.time = TQTime.currentTime()
- internalTimer = TQTimer(self)
- self.connect(internalTimer, SIGNAL("timeout()"), self.timeout)
- internalTimer.start(5000)
-
- def timeout(self):
- new_time = TQTime.currentTime()
- if new_time.minute() != self.time.minute():
- self.update()
-
- def paintEvent(self, qe):
- if not self.isVisible():
- return
- self.time = TQTime.currentTime()
-
- pts = TQPointArray()
- paint = TQPainter(self)
- paint.setBrush(self.foregroundColor())
-
- cp = TQPoint(self.rect().center())
- d = TQMIN(self.width(), self.height())
- matrix = TQWMatrix()
- matrix.translate(cp.x(), cp.y())
- matrix.scale(d/1000.0, d/1000.0)
-
- h_angle = 30*(self.time.hour()%12 - 3) + self.time.minute()/2
- matrix.rotate(h_angle)
- paint.setWorldMatrix(matrix)
- pts.setPoints([-20,0,0,-20,300,0,0,20])
- paint.drawPolygon(pts)
- matrix.rotate(-h_angle)
-
- m_angle = (self.time.minute()-15)*6
- matrix.rotate(m_angle)
- paint.setWorldMatrix(matrix)
- pts.setPoints([-10,0,0,-10,400,0,0,10])
- paint.drawPolygon(pts)
- matrix.rotate(-m_angle)
-
- for i in range(0,12):
- paint.setWorldMatrix(matrix)
- paint.drawLine(450,0, 500,0)
- matrix.rotate(30)
-
-a = TQApplication(sys.argv)
-clock = AnalogClock()
-clock.resize(100,100)
-a.setMainWidget(clock)
-clock.show()
-a.exec_loop()