title: Can't draw in pyqt5
body: <p>I'm trying to design a simple program that I can draw inside of. I want points to be drawn on the screen when the mouse is clicked. I am trying to use QPainter, but it doesn't seem to be working as intended (That is to say, when I click, nothing is drawn on the screen). Any help would be appreciated.</p>
  
  <p><a href="https://pastebin.com/TUcXQLa6" rel="nofollow noreferrer">Link to the code</a></p>
  
  <pre><code>from PyQt5.QtWidgets import QWidget, QApplication
  from PyQt5.QtGui import QPainter
  from PyQt5.QtCore import *
  import sys, random
  
  
  class Example(QWidget):
      def __init__(self):
          super().__init__()
  
          self.initUI()
  
      def initUI(self):
          self.qp = QPainter()
          self.qp.begin(self)
          self.setGeometry(300, 300, 300, 190)
          self.setWindowTitle('Draw')
          self.y = 0
          self.x = 0
          self.show()
  
      def drawPoints(self, qp):
          qp.setPen(Qt.red)
          size = self.size()
          qp.drawPoint(self.x, self.y)
      def mouseMoveEvent(self, QMouseEvent):
          pos = QMouseEvent.pos()
          self.x = pos.x()
          self.y = pos.y()
          self.drawPoints(self.qp)
      def closeEvent(self, QCloseEvent):
          self.qp.end()
  
  
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      ex = Example()
      sys.exit(app.exec_())
  </code></pre>