summaryrefslogtreecommitdiffstats
path: root/examples3/canvas
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-29 01:11:08 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-29 01:11:08 -0600
commit8a055d66f43592c257cece2eb8cc021808062917 (patch)
treed0922f201bd5d24b62a33160d1d9baf9e89f9a70 /examples3/canvas
parentb388516ca2691303a076a0764fd40bf7116fe43d (diff)
downloadpytqt-8a055d66f43592c257cece2eb8cc021808062917.tar.gz
pytqt-8a055d66f43592c257cece2eb8cc021808062917.zip
Initial TQt conversion
Diffstat (limited to 'examples3/canvas')
-rw-r--r--examples3/canvas/butterfly.pngbin37900 -> 37905 bytes
-rwxr-xr-xexamples3/canvas/canvas.py262
-rw-r--r--examples3/canvas/qtlogo.pngbin22673 -> 22675 bytes
3 files changed, 131 insertions, 131 deletions
diff --git a/examples3/canvas/butterfly.png b/examples3/canvas/butterfly.png
index d8912d2..5d82201 100644
--- a/examples3/canvas/butterfly.png
+++ b/examples3/canvas/butterfly.png
Binary files differ
diff --git a/examples3/canvas/canvas.py b/examples3/canvas/canvas.py
index 178a6e6..7d36592 100755
--- a/examples3/canvas/canvas.py
+++ b/examples3/canvas/canvas.py
@@ -8,22 +8,22 @@ import random
True = 1
False = 0
-butterfly_fn = QString.null
+butterfly_fn = TQString.null
butterflyimg = []
-logo_fn = QString.null
+logo_fn = TQString.null
logoimg = []
bouncy_logo = None
views = []
-class ImageItem(QCanvasRectangle):
+class ImageItem(TQCanvasRectangle):
def __init__(self,img,canvas):
- QCanvasRectangle.__init__(self,canvas)
+ TQCanvasRectangle.__init__(self,canvas)
self.imageRTTI=984376
self.image=img
- self.pixmap=QPixmap()
+ self.pixmap=TQPixmap()
self.setSize(self.image.width(), self.image.height())
- self.pixmap.convertFromImage(self.image, Qt.OrderedAlphaDither);
+ self.pixmap.convertFromImage(self.image, TQt.OrderedAlphaDither);
def rtti(self):
return self.imageRTTI
@@ -40,13 +40,13 @@ class ImageItem(QCanvasRectangle):
p.drawPixmap( self.x(), self.y(), self.pixmap )
-class NodeItem(QCanvasEllipse):
+class NodeItem(TQCanvasEllipse):
def __init__(self,canvas):
- QCanvasEllipse.__init__(self,6,6,canvas)
+ TQCanvasEllipse.__init__(self,6,6,canvas)
self.__inList=[]
self.__outList=[]
- self.setPen(QPen(Qt.black))
- self.setBrush(QBrush(Qt.red))
+ self.setPen(TQPen(TQt.black))
+ self.setBrush(TQBrush(TQt.red))
self.setZ(128)
def addInEdge(self,edge):
@@ -56,19 +56,19 @@ class NodeItem(QCanvasEllipse):
self.__outList.append(edge)
def moveBy(self,dx,dy):
- QCanvasEllipse.moveBy(self,dx,dy)
+ TQCanvasEllipse.moveBy(self,dx,dy)
for each_edge in self.__inList:
each_edge.setToPoint( int(self.x()), int(self.y()) )
for each_edge in self.__outList:
each_edge.setFromPoint( int(self.x()), int(self.y()) )
-class EdgeItem(QCanvasLine):
+class EdgeItem(TQCanvasLine):
__c=0
def __init__(self,fromNode, toNode,canvas):
- QCanvasLine.__init__(self,canvas)
+ TQCanvasLine.__init__(self,canvas)
self.__c=self.__c+1
- self.setPen(QPen(Qt.black))
- self.setBrush(QBrush(Qt.red))
+ self.setPen(TQPen(TQt.black))
+ self.setBrush(TQBrush(TQt.red))
fromNode.addOutEdge(self)
toNode.addInEdge(self)
self.setPoints(int(fromNode.x()),int(fromNode.y()), int(toNode.x()), int(toNode.y()))
@@ -87,15 +87,15 @@ class EdgeItem(QCanvasLine):
pass
-class FigureEditor(QCanvasView):
+class FigureEditor(TQCanvasView):
def __init__(self,c,parent,name,f):
- QCanvasView.__init__(self,c,parent,name,f)
+ TQCanvasView.__init__(self,c,parent,name,f)
self.__moving=0
self.__moving_start= 0
- def contentsMousePressEvent(self,e): # QMouseEvent e
+ def contentsMousePressEvent(self,e): # TQMouseEvent e
point = self.inverseWorldMatrix().map(e.pos())
- ilist = self.canvas().collisions(point) #QCanvasItemList ilist
+ ilist = self.canvas().collisions(point) #TQCanvasItemList ilist
for each_item in ilist:
if each_item.rtti()==984376:
if not each_item.hit(point):
@@ -121,14 +121,14 @@ class FigureEditor(QCanvasView):
self.canvas().update()
-class BouncyLogo(QCanvasSprite):
+class BouncyLogo(TQCanvasSprite):
def __init__(self,canvas):
# Make sure the logo exists.
global bouncy_logo
if bouncy_logo is None:
- bouncy_logo=QCanvasPixmapArray("qt-trans.xpm")
+ bouncy_logo=TQCanvasPixmapArray("qt-trans.xpm")
- QCanvasSprite.__init__(self,None,canvas)
+ TQCanvasSprite.__init__(self,None,canvas)
self.setSequence(bouncy_logo)
self.setAnimated(True)
self.initPos()
@@ -194,65 +194,65 @@ class BouncyLogo(QCanvasSprite):
self.setVelocity(vx,vy)
elif stage==1:
- QCanvasItem.advance(self,stage)
+ TQCanvasItem.advance(self,stage)
-class Main (QMainWindow):
+class Main (TQMainWindow):
def __init__(self,c,parent,name,f=0):
- QMainWindow.__init__(self,parent,name,f)
+ TQMainWindow.__init__(self,parent,name,f)
self.editor=FigureEditor(c,self,name,f)
- self.printer=QPrinter()
+ self.printer=TQPrinter()
self.dbf_id=0
self.canvas=c
self.mainCount=0
- file=QPopupMenu(self.menuBar())
- file.insertItem("&Fill canvas", self.init, Qt.CTRL+Qt.Key_F)
- file.insertItem("&Erase canvas", self.clear, Qt.CTRL+Qt.Key_E)
- file.insertItem("&New view", self.newView, Qt.CTRL+Qt.Key_N)
+ file=TQPopupMenu(self.menuBar())
+ file.insertItem("&Fill canvas", self.init, TQt.CTRL+TQt.Key_F)
+ file.insertItem("&Erase canvas", self.clear, TQt.CTRL+TQt.Key_E)
+ file.insertItem("&New view", self.newView, TQt.CTRL+TQt.Key_N)
file.insertSeparator();
- file.insertItem("&Print", self._print, Qt.CTRL+Qt.Key_P)
+ file.insertItem("&Print", self._print, TQt.CTRL+TQt.Key_P)
file.insertSeparator()
- file.insertItem("E&xit", qApp, SLOT("quit()"), Qt.CTRL+Qt.Key_Q)
+ file.insertItem("E&xit", qApp, SLOT("quit()"), TQt.CTRL+TQt.Key_Q)
self.menuBar().insertItem("&File", file)
- edit = QPopupMenu(self.menuBar() )
- edit.insertItem("Add &Circle", self.addCircle, Qt.ALT+Qt.Key_C)
- edit.insertItem("Add &Hexagon", self.addHexagon, Qt.ALT+Qt.Key_H)
- edit.insertItem("Add &Polygon", self.addPolygon, Qt.ALT+Qt.Key_P)
- edit.insertItem("Add Spl&ine", self.addSpline, Qt.ALT+Qt.Key_I)
- edit.insertItem("Add &Text", self.addText, Qt.ALT+Qt.Key_T)
- edit.insertItem("Add &Line", self.addLine, Qt.ALT+Qt.Key_L)
- edit.insertItem("Add &Rectangle", self.addRectangle, Qt.ALT+Qt.Key_R)
- edit.insertItem("Add &Sprite", self.addSprite, Qt.ALT+Qt.Key_S)
- edit.insertItem("Create &Mesh", self.addMesh, Qt.ALT+Qt.Key_M )
- edit.insertItem("Add &Alpha-blended image", self.addButterfly, Qt.ALT+Qt.Key_A)
+ edit = TQPopupMenu(self.menuBar() )
+ edit.insertItem("Add &Circle", self.addCircle, TQt.ALT+TQt.Key_C)
+ edit.insertItem("Add &Hexagon", self.addHexagon, TQt.ALT+TQt.Key_H)
+ edit.insertItem("Add &Polygon", self.addPolygon, TQt.ALT+TQt.Key_P)
+ edit.insertItem("Add Spl&ine", self.addSpline, TQt.ALT+TQt.Key_I)
+ edit.insertItem("Add &Text", self.addText, TQt.ALT+TQt.Key_T)
+ edit.insertItem("Add &Line", self.addLine, TQt.ALT+TQt.Key_L)
+ edit.insertItem("Add &Rectangle", self.addRectangle, TQt.ALT+TQt.Key_R)
+ edit.insertItem("Add &Sprite", self.addSprite, TQt.ALT+TQt.Key_S)
+ edit.insertItem("Create &Mesh", self.addMesh, TQt.ALT+TQt.Key_M )
+ edit.insertItem("Add &Alpha-blended image", self.addButterfly, TQt.ALT+TQt.Key_A)
self.menuBar().insertItem("&Edit", edit)
- view = QPopupMenu(self.menuBar() );
- view.insertItem("&Enlarge", self.enlarge, Qt.SHIFT+Qt.CTRL+Qt.Key_Plus);
- view.insertItem("Shr&ink", self.shrink, Qt.SHIFT+Qt.CTRL+Qt.Key_Minus);
+ view = TQPopupMenu(self.menuBar() );
+ view.insertItem("&Enlarge", self.enlarge, TQt.SHIFT+TQt.CTRL+TQt.Key_Plus);
+ view.insertItem("Shr&ink", self.shrink, TQt.SHIFT+TQt.CTRL+TQt.Key_Minus);
view.insertSeparator();
- view.insertItem("&Rotate clockwise", self.rotateClockwise, Qt.CTRL+Qt.Key_PageDown);
- view.insertItem("Rotate &counterclockwise", self.rotateCounterClockwise, Qt.CTRL+Qt.Key_PageUp);
- view.insertItem("&Zoom in", self.zoomIn, Qt.CTRL+Qt.Key_Plus);
- view.insertItem("Zoom &out", self.zoomOut, Qt.CTRL+Qt.Key_Minus);
- view.insertItem("Translate left", self.moveL, Qt.CTRL+Qt.Key_Left);
- view.insertItem("Translate right", self.moveR, Qt.CTRL+Qt.Key_Right);
- view.insertItem("Translate up", self.moveU, Qt.CTRL+Qt.Key_Up);
- view.insertItem("Translate down", self.moveD, Qt.CTRL+Qt.Key_Down);
- view.insertItem("&Mirror", self.mirror, Qt.CTRL+Qt.Key_Home);
+ view.insertItem("&Rotate clockwise", self.rotateClockwise, TQt.CTRL+TQt.Key_PageDown);
+ view.insertItem("Rotate &counterclockwise", self.rotateCounterClockwise, TQt.CTRL+TQt.Key_PageUp);
+ view.insertItem("&Zoom in", self.zoomIn, TQt.CTRL+TQt.Key_Plus);
+ view.insertItem("Zoom &out", self.zoomOut, TQt.CTRL+TQt.Key_Minus);
+ view.insertItem("Translate left", self.moveL, TQt.CTRL+TQt.Key_Left);
+ view.insertItem("Translate right", self.moveR, TQt.CTRL+TQt.Key_Right);
+ view.insertItem("Translate up", self.moveU, TQt.CTRL+TQt.Key_Up);
+ view.insertItem("Translate down", self.moveD, TQt.CTRL+TQt.Key_Down);
+ view.insertItem("&Mirror", self.mirror, TQt.CTRL+TQt.Key_Home);
self.menuBar().insertItem("&View", view)
- self.options = QPopupMenu( self.menuBar() );
+ self.options = TQPopupMenu( self.menuBar() );
self.dbf_id = self.options.insertItem("Double buffer", self.toggleDoubleBuffer)
self.options.setItemChecked(self.dbf_id, True)
self.menuBar().insertItem("&Options",self.options)
self.menuBar().insertSeparator();
- help = QPopupMenu( self.menuBar() )
- help.insertItem("&About", self.help, Qt.Key_F1)
- help.insertItem("&About Qt", self.aboutQt, Qt.Key_F2)
+ help = TQPopupMenu( self.menuBar() )
+ help.insertItem("&About", self.help, TQt.Key_F1)
+ help.insertItem("&About TQt", self.aboutTQt, TQt.Key_F2)
help.setItemChecked(self.dbf_id, True)
self.menuBar().insertItem("&Help",help)
@@ -279,7 +279,7 @@ class Main (QMainWindow):
self.addLogo()
def newView(self):
- m=Main(self.canvas,None,"new windiw",Qt.WDestructiveClose)
+ m=Main(self.canvas,None,"new windiw",TQt.WDestructiveClose)
qApp.setMainWidget(m)
m.show()
qApp.setMainWidget(None)
@@ -289,10 +289,10 @@ class Main (QMainWindow):
self.editor.clear()
def help(self):
- QMessageBox.information(None, "PyQt Canvas Example",
- "<h3>The PyQt QCanvas classes example</h3><hr>"
- "<p>This is the PyQt implementation of "
- "Qt canvas example.</p> by Sadi Kose "
+ TQMessageBox.information(None, "PyTQt Canvas Example",
+ "<h3>The PyTQt TQCanvas classes example</h3><hr>"
+ "<p>This is the PyTQt implementation of "
+ "TQt canvas example.</p> by Sadi Kose "
"<i>(kose@nuvox.net)</i><hr>"
"<ul>"
"<li> Press ALT-S for some sprites."
@@ -302,8 +302,8 @@ class Main (QMainWindow):
"<li> Read the code!"
"</ul>","Dismiss")
- def aboutQt(self):
- QMessageBox.aboutQt(self,"PyQt Canvas Example")
+ def aboutTQt(self):
+ TQMessageBox.aboutTQt(self,"PyTQt Canvas Example")
def toggleDoubleBuffer(self):
s = not self.options.isItemChecked(self.dbf_id)
@@ -363,10 +363,10 @@ class Main (QMainWindow):
def _print(self):
if not self.printer:
- self.printer = QPrinter()
+ self.printer = TQPrinter()
if self.printer.setup(self) :
- pp=QPainter(self.printer)
- self.canvas.drawArea(QRect(0,0,self.canvas.width(),self.canvas.height()),pp,False)
+ pp=TQPainter(self.printer)
+ self.canvas.drawArea(TQRect(0,0,self.canvas.width(),self.canvas.height()),pp,False)
def addSprite(self):
i = BouncyLogo(self.canvas)
@@ -377,15 +377,15 @@ class Main (QMainWindow):
if butterfly_fn.isEmpty():
return
if not butterflyimg:
- butterflyimg.append(QImage())
+ butterflyimg.append(TQImage())
butterflyimg[0].load(butterfly_fn)
- butterflyimg.append(QImage())
+ butterflyimg.append(TQImage())
butterflyimg[1] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.75),
int(butterflyimg[0].height()*0.75) )
- butterflyimg.append(QImage())
+ butterflyimg.append(TQImage())
butterflyimg[2] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.5),
int(butterflyimg[0].height()*0.5) )
- butterflyimg.append(QImage())
+ butterflyimg.append(TQImage())
butterflyimg[3] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.25),
int(butterflyimg[0].height()*0.25) )
@@ -399,15 +399,15 @@ class Main (QMainWindow):
if logo_fn.isEmpty():
return;
if not logoimg:
- logoimg.append(QImage())
+ logoimg.append(TQImage())
logoimg[0].load( logo_fn )
- logoimg.append(QImage())
+ logoimg.append(TQImage())
logoimg[1] = logoimg[0].smoothScale( int(logoimg[0].width()*0.75),
int(logoimg[0].height()*0.75) )
- logoimg.append(QImage())
+ logoimg.append(TQImage())
logoimg[2] = logoimg[0].smoothScale( int(logoimg[0].width()*0.5),
int(logoimg[0].height()*0.5) )
- logoimg.append(QImage())
+ logoimg.append(TQImage())
logoimg[3] = logoimg[0].smoothScale( int(logoimg[0].width()*0.25),
int(logoimg[0].height()*0.25) );
@@ -418,79 +418,79 @@ class Main (QMainWindow):
i.show()
def addCircle(self):
- i = QCanvasEllipse(50,50,self.canvas)
- i.setBrush( QBrush(QColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) ))
+ i = TQCanvasEllipse(50,50,self.canvas)
+ i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) ))
i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height())
i.setZ(256*random.random()%256)
i.show()
def addHexagon(self):
- i = QCanvasPolygon(self.canvas)
+ i = TQCanvasPolygon(self.canvas)
size = canvas.width() / 25
- pa=QPointArray(6)
- pa.setPoint(0,QPoint(2*size,0))
- pa.setPoint(1,QPoint(size,-size*173/100))
- pa.setPoint(2,QPoint(-size,-size*173/100))
- pa.setPoint(3,QPoint(-2*size,0))
- pa.setPoint(4,QPoint(-size,size*173/100))
- pa.setPoint(5,QPoint(size,size*173/100))
+ pa=TQPointArray(6)
+ pa.setPoint(0,TQPoint(2*size,0))
+ pa.setPoint(1,TQPoint(size,-size*173/100))
+ pa.setPoint(2,TQPoint(-size,-size*173/100))
+ pa.setPoint(3,TQPoint(-2*size,0))
+ pa.setPoint(4,TQPoint(-size,size*173/100))
+ pa.setPoint(5,TQPoint(size,size*173/100))
i.setPoints(pa)
- i.setBrush( QBrush(QColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) ))
+ i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) ))
i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height())
i.setZ(256*random.random()%256)
i.show()
def addPolygon(self):
- i = QCanvasPolygon(self.canvas)
+ i = TQCanvasPolygon(self.canvas)
size = self.canvas.width()/2
- pa=QPointArray(6)
- pa.setPoint(0, QPoint(0,0))
- pa.setPoint(1, QPoint(size,size/5))
- pa.setPoint(2, QPoint(size*4/5,size))
- pa.setPoint(3, QPoint(size/6,size*5/4))
- pa.setPoint(4, QPoint(size*3/4,size*3/4))
- pa.setPoint(5, QPoint(size*3/4,size/4))
+ pa=TQPointArray(6)
+ pa.setPoint(0, TQPoint(0,0))
+ pa.setPoint(1, TQPoint(size,size/5))
+ pa.setPoint(2, TQPoint(size*4/5,size))
+ pa.setPoint(3, TQPoint(size/6,size*5/4))
+ pa.setPoint(4, TQPoint(size*3/4,size*3/4))
+ pa.setPoint(5, TQPoint(size*3/4,size/4))
i.setPoints(pa)
- i.setBrush(QBrush( QColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8)) )
+ i.setBrush(TQBrush( TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8)) )
i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height())
i.setZ(256*random.random()%256)
i.show()
def addSpline(self):
- i = QCanvasSpline(self.canvas)
+ i = TQCanvasSpline(self.canvas)
size = canvas.width()/6
- pa=QPointArray(12)
- pa.setPoint(0,QPoint(0,0))
- pa.setPoint(1,QPoint(size/2,0))
- pa.setPoint(2,QPoint(size,size/2))
- pa.setPoint(3,QPoint(size,size))
- pa.setPoint(4,QPoint(size,size*3/2))
- pa.setPoint(5,QPoint(size/2,size*2))
- pa.setPoint(6,QPoint(0,size*2))
- pa.setPoint(7,QPoint(-size/2,size*2))
- pa.setPoint(8,QPoint(size/4,size*3/2))
- pa.setPoint(9,QPoint(0,size))
- pa.setPoint(10,QPoint(-size/4,size/2))
- pa.setPoint(11,QPoint(-size/2,0))
+ pa=TQPointArray(12)
+ pa.setPoint(0,TQPoint(0,0))
+ pa.setPoint(1,TQPoint(size/2,0))
+ pa.setPoint(2,TQPoint(size,size/2))
+ pa.setPoint(3,TQPoint(size,size))
+ pa.setPoint(4,TQPoint(size,size*3/2))
+ pa.setPoint(5,TQPoint(size/2,size*2))
+ pa.setPoint(6,TQPoint(0,size*2))
+ pa.setPoint(7,TQPoint(-size/2,size*2))
+ pa.setPoint(8,TQPoint(size/4,size*3/2))
+ pa.setPoint(9,TQPoint(0,size))
+ pa.setPoint(10,TQPoint(-size/4,size/2))
+ pa.setPoint(11,TQPoint(-size/2,0))
i.setControlPoints(pa)
- i.setBrush( QBrush(QColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) ))
+ i.setBrush( TQBrush(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8) ))
i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height())
i.setZ(256*random.random()%256)
i.show()
def addText(self):
- i = QCanvasText(self.canvas)
- i.setText("QCanvasText")
+ i = TQCanvasText(self.canvas)
+ i.setText("TQCanvasText")
i.move(self.canvas.width()*random.random()%self.canvas.width(),self.canvas.width()*random.random()%self.canvas.height())
i.setZ(256*random.random()%256)
i.show()
def addLine(self):
- i = QCanvasLine(self.canvas);
+ i = TQCanvasLine(self.canvas);
i.setPoints( self.canvas.width()*random.random()%self.canvas.width(), self.canvas.width()*random.random()%self.canvas.height(),
self.canvas.width()*random.random()%self.canvas.width(), self.canvas.width()*random.random()%self.canvas.height() )
- i.setPen( QPen(QColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8), 6) )
+ i.setPen( TQPen(TQColor(256*random.random()%32*8,256*random.random()%32*8,256*random.random()%32*8), 6) )
i.setZ(256*random.random()%256)
i.show()
@@ -505,9 +505,9 @@ class Main (QMainWindow):
y0 = 0;
if not self.tb:
- self.tb = QBrush( Qt.red )
+ self.tb = TQBrush( TQt.red )
if not self.tp:
- self.tp = QPen( Qt.black )
+ self.tp = TQPen( TQt.black )
nodecount = 0;
@@ -519,7 +519,7 @@ class Main (QMainWindow):
cols = w / dist
#ifndef QT_NO_PROGRESSDIALOG
- #progress=QProgressDialog( "Creating mesh...", "Abort", rows,
+ #progress=TQProgressDialog( "Creating mesh...", "Abort", rows,
# self, "progress", True );
#endif
@@ -566,12 +566,12 @@ class Main (QMainWindow):
#// qDebug( "%d nodes, %d edges", nodecount, EdgeItem::count() );
def addRectangle(self):
- i = QCanvasRectangle( self.canvas.width()*random.random()%self.canvas.width(),
+ i = TQCanvasRectangle( self.canvas.width()*random.random()%self.canvas.width(),
self.canvas.width()*random.random()%self.canvas.height(),
self.canvas.width()/5,self.canvas.width()/5,self.canvas)
z = 256*random.random()%256
- i.setBrush( QBrush(QColor(z,z,z) ))
- i.setPen( QPen(QColor(self.canvas.width()*random.random()%32*8,
+ i.setBrush( TQBrush(TQColor(z,z,z) ))
+ i.setPen( TQPen(TQColor(self.canvas.width()*random.random()%32*8,
self.canvas.width()*random.random()%32*8,
self.canvas.width()*random.random()%32*8), 6) )
i.setZ(z)
@@ -579,26 +579,26 @@ class Main (QMainWindow):
if __name__=='__main__':
- app=QApplication(sys.argv)
+ app=TQApplication(sys.argv)
if len(sys.argv) > 1:
- butterfly_fn=QString(sys.argv[1])
+ butterfly_fn=TQString(sys.argv[1])
else:
- butterfly_fn=QString("butterfly.png")
+ butterfly_fn=TQString("butterfly.png")
if len(sys.argv) > 2:
- logo_fn = QString(sys.argv[2])
+ logo_fn = TQString(sys.argv[2])
else:
- logo_fn=QString("qtlogo.png")
+ logo_fn=TQString("qtlogo.png")
- canvas=QCanvas(800,600)
+ canvas=TQCanvas(800,600)
canvas.setAdvancePeriod(30)
m=Main(canvas,None,"pyqt canvas example")
m.resize(m.sizeHint())
qApp.setMainWidget(m)
- m.setCaption("Qt Canvas Example ported to PyQt")
- if QApplication.desktop().width() > m.width() + 10 and QApplication.desktop().height() > m.height() + 30:
+ m.setCaption("TQt Canvas Example ported to PyTQt")
+ if TQApplication.desktop().width() > m.width() + 10 and TQApplication.desktop().height() > m.height() + 30:
m.show()
else:
m.showMaximized()
@@ -607,7 +607,7 @@ if __name__=='__main__':
#// m.help();
qApp.setMainWidget(None);
- QObject.connect( qApp, SIGNAL("lastWindowClosed()"), qApp, SLOT("quit()") )
+ TQObject.connect( qApp, SIGNAL("lastWindowClosed()"), qApp, SLOT("quit()") )
app.exec_loop()
diff --git a/examples3/canvas/qtlogo.png b/examples3/canvas/qtlogo.png
index a48b1a1..5961457 100644
--- a/examples3/canvas/qtlogo.png
+++ b/examples3/canvas/qtlogo.png
Binary files differ