import sys
import qt
import qtcanvas
class TMainWindow(qtcanvas.QCanvasView):
def __init__(self, *args):
qtcanvas.QCanvasView.__init__(self, *args)
oMatrix = qt.QWMatrix()
oMatrix.scale(2, 2)
self.setWorldMatrix(oMatrix)
oRect = qtcanvas.QCanvasRectangle(20, 50, 100, 100, self.canvas())
oRect.show()
def closeEvent(self, e):
oApp.quit()
canvas = qtcanvas.QCanvas(2000, 2000)
oMainWindow = TMainWindow(canvas, None, 'Main Window')
oMainWindow.show()
oApp.exec_loop()
import sys
import qt
import qtcanvas
class TMainWindow(qtcanvas.QCanvasView):
def __init__(self, *args):
qtcanvas.QCanvasView.__init__(self, *args)
oMatrix = qt.QWMatrix()
oMatrix.scale(2, 2)
self.setWorldMatrix(oMatrix)
oRect = qtcanvas.QCanvasRectangle(20, 50, 100, 100, self.canvas())
oRect.setBrush(qt.QBrush(qt.QColor('red')))
oRect.show()
def closeEvent(self, e):
oApp.quit()
oApp = qt.QApplication(sys.argv)
canvas = qtcanvas.QCanvas(2000, 2000)
oMainWindow = TMainWindow(canvas, None, 'Main Window')
oMainWindow.show()
oApp.exec_loop()
To copy to clipboard, switch view to plain text mode
Bookmarks