Skip to content

Instantly share code, notes, and snippets.

@chomy
Created December 6, 2013 02:47
Show Gist options
  • Select an option

  • Save chomy/7817816 to your computer and use it in GitHub Desktop.

Select an option

Save chomy/7817816 to your computer and use it in GitHub Desktop.
import sys
import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui
class painter(QtGui.QWidget):
def __init__(self, parent=None):
super(painter,self).__init__(parent)
self.resize(400,300)
self.setWindowTitle('QPainter Test')
def paintEvent(self, event):
p = QtGui.QPainter()
p.begin(self)
p.setPen(QtGui.QColor(0, 0, 255))
p.drawLine(0,0, 100,100)
p.end()
app = QtGui.QApplication(sys.argv)
p = painter()
p.show()
app.exec_()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment