title: PyQt5 - drawPixmap on QMainWindow with toolbar (can't fit to window)
body: <p>I have a <code>QMainWindow</code> with a toolbar, and I'm having troubles with fitting the <code>QPixmap</code> to the window, such that it won't tackle with the toolbar.</p>
  
  <p>I want to display the picture:</p>
  
  <p><a href="https://i.stack.imgur.com/leG0m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/leG0m.png" alt="enter image description here"></a></p>
  
  <p>And from the code:</p>
  
  <pre><code>import sys
  from PyQt5.QtCore import QRect
  from PyQt5.QtWidgets import QAction, QMainWindow, QApplication
  from PyQt5.QtGui import QPixmap, QPainter
  
  
  class Menu(QMainWindow):
  
      def __init__(self):
          super().__init__()
          newAct = QAction('New', self)
          self.toolbar = self.addToolBar('Remove')
          self.toolbar.addAction(newAct)
          self.image = QPixmap("background.png")
          self.setGeometry(100, 30, 500, 300)
          self.resize(self.image.width(), self.image.height())
          self.show()
  
      def paintEvent(self, event):
          painter = QPainter(self)
          rect = QRect(0, 0, self.image.width(), self.image.height())
          painter.drawPixmap(rect, self.image)
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      mainMenu = Menu()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>I get:</p>
  
  <p><a href="https://i.stack.imgur.com/qjOm9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qjOm9.png" alt="enter image description here"></a></p>
  
  <p>And as you can see, The picture is on the toolbar as well, and I don't want that.</p>
  
  <p>Another try:</p>
  
  <pre><code>import sys
  from PyQt5.QtCore import QRect
  from PyQt5.QtWidgets import QAction, QMainWindow, QApplication
  from PyQt5.QtGui import QPixmap, QPainter
  
  
  class Menu(QMainWindow):
  
      def __init__(self):
          super().__init__()
          newAct = QAction('New', self)
          self.toolbar = self.addToolBar('Remove')
          self.toolbar.addAction(newAct)
          self.image = QPixmap("background.png")
          self.setGeometry(100, 30, 500, 300)
          self.resize(self.image.width(), self.image.height() + self.toolbar.height())
          self.show()
  
      def paintEvent(self, event):
          painter = QPainter(self)
          rect = QRect(0, self.toolbar.height(), self.image.width(), self.image.height() + self.toolbar.height())
          painter.drawPixmap(rect, self.image)
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      mainMenu = Menu()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>But I get:</p>
  
  <p><a href="https://i.stack.imgur.com/EQWnq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EQWnq.png" alt="enter image description here"></a></p>
  
  <p>And as you can see, I don't see one of the lines (the blue one).</p>
  
  <p>How can I fix it, so the picture will fit the window excluding the toolbar?
  In addition to that, it means I'll have to change all my mouse clicks to move the y-axis. Is there perhaps a way I can set everything such that (x,y)=(0,0) would be at the uppermost left, below the toolbar?</p>
  
  <p>I'm using Python 3.6.5 |Anaconda custom (64-bit) on windows | PyQt version: 5.9.2 </p>