summaryrefslogtreecommitdiffstats
path: root/examples3/drawlines.py
diff options
context:
space:
mode:
authoraneejit1 <[email protected]>2022-07-28 15:46:19 +0000
committerSlávek Banko <[email protected]>2022-07-31 16:41:03 +0200
commit4978511ebb7e8d31dab64485d1ac87b6e004be81 (patch)
treea2da3161f070116baa15de7276c5c0c9ac855e8f /examples3/drawlines.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 <[email protected]> (cherry picked from commit e602246539fd7435aaeb440fcb7f852c92c8426b)
Diffstat (limited to 'examples3/drawlines.py')
-rwxr-xr-xexamples3/drawlines.py74
1 files changed, 0 insertions, 74 deletions
diff --git a/examples3/drawlines.py b/examples3/drawlines.py
deleted file mode 100755
index c1553f2..0000000
--- a/examples3/drawlines.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-
-import sys, random
-from python_tqt.qt import *
-
-TRUE = 1
-FALSE = 0
-
-MAXPOINTS = 2000; # maximum number of points
-MAXCOLORS = 40;
-
-#
-# ConnectWidget - draws connected lines
-#
-
-class ConnectWidget(TQWidget):
- def __init__(self):
- TQWidget.__init__(self)
- self.setEraseColor( TQt.white ) # white background
- self.count = 0;
- self.down = FALSE
-
- self.points = []
- self.colors = []
-
- for i in range(MAXPOINTS): # init arrays
- self.points.append(TQPoint())
- for i in range(MAXCOLORS):
- self.colors.append(TQColor( random.randint(0,255), random.randint(0,255), random.randint(0,255) ))
-
-#
-# Handles paint events for the connect widget.
-#
- def paintEvent(self, pe):
- paint = TQPainter( self )
- for i in range(self.count-1): # connect all points
- for j in range(i+1, self.count):
- paint.setPen( self.colors[random.randint(0,MAXCOLORS-1)] ) # set random pen color
- paint.drawLine( self.points[i], self.points[j] ) # draw line
-
-#
-# Handles mouse press events for the connect widget.
-#
- def mousePressEvent(self, me):
- self.down = TRUE
- self.count = 0 # start recording points
- self.erase() # erase widget contents
-
-#
-# Handles mouse release events for the connect widget.
-#
- def mouseReleaseEvent(self, me ):
- self.down = FALSE # done recording points
- self.update() # draw the lines
-
-#
-# Handles mouse move events for the connect widget.
-#
- def mouseMoveEvent(self, me):
- if self.down and self.count < MAXPOINTS:
- paint = TQPainter( self )
- self.points[self.count] = TQPoint(me.pos()) # add point
- paint.drawPoint( me.pos() ) # plot point
- self.count = self.count+1
-
-#
-# Create and display a ConnectWidget.
-#
-a = TQApplication( sys.argv )
-connect = ConnectWidget()
-connect.setCaption( "PyTQt Example - Draw lines")
-a.setMainWidget( connect )
-connect.show()
-a.exec_loop()