GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Friday, April 1, 2011

PyQt - 2D Graphics

import sys
from PyQt4 import QtGui, QtCore

class Editor(QtGui.QWidget):

    def __init__(self):
        super(Editor, self).__init__()
        self.initUI()

    def initUI(self):

        self.setGeometry(200, 100, 400, 300)
        self.setWindowTitle('Editor App')
        self.setWindowIcon(QtGui.QIcon('e.png'))

    def paintEvent(self, e):
        qp = QtGui.QPainter()
        qp.begin(self)
        qp.drawRect(10,10,100,100)
        qp.end()



app = QtGui.QApplication(sys.argv)
file = Editor()
file.show()
sys.exit(app.exec_())
Share/Bookmark

No comments:

Post a Comment