title: PyQt5 - Increase main window size by pressing a button
body: <p>I currently have a window which size is 775x380 and a button. I want to increase the height of my window to 775x780 when I click the button, but for some reason is not working. This is the function I call when pressing the button (dock, which has "+" text on it from the start):</p>
  
  <pre><code>def resize(self):
      if self.dock.text() == '+':
          print('increase size')
          self.resize(775,780)
          self.dock.setText("-")
      else:
          print('decrease size')
          self.resize(775,380)
          self.dock.setText("+")
  </code></pre>
  
  <p>The print commands are more for debugging and they work fine, but for some reason the 'self.resize(775,780)' is not working. The window remains the same size and the button changes it's text from '+' to '-' and viceversa.</p>
  
  <p>Edit for clarification: resize() is a function within class MainWindow(object)
  Edit 2: Here is the whole code I'm using (the relevant part of the code at least)</p>
  
  <pre><code>from PyQt5 import QtCore, QtGui, QtWidgets
  
  class MainWindow(QtWidgets.QMainWindow):
  
      def setupUi(self, MainWindow):
  
          #MAIN WINDOW
          MainWindow.setObjectName("MainWindow")
          MainWindow.resize(775, 340)
          MainWindow.setWindowTitle("MainWindow")
  
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          #APPLY BUTTON
          self.apply = QtWidgets.QPushButton(self.centralwidget)
          self.apply.setGeometry(QtCore.QRect(440, 10, 75, 25))
          self.apply.setText("Apply")
          self.apply.setObjectName("apply")
  
          #REREF BUTTON
          self.reref = QtWidgets.QPushButton(self.centralwidget)
          self.reref.setGeometry(QtCore.QRect(280, 10, 75, 25))
          self.reref.setText("Re Ref")
          self.reref.setObjectName("reref")
  
          MainWindow.setCentralWidget(self.centralwidget)
          self.menubar = QtWidgets.QMenuBar(MainWindow)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 1324, 21))
          self.menubar.setObjectName("menubar")
          MainWindow.setMenuBar(self.menubar)
          self.statusbar = QtWidgets.QStatusBar(MainWindow)
          self.statusbar.setObjectName("statusbar")
          MainWindow.setStatusBar(self.statusbar)
  
          #RESIZE BUTTON
          self.dock = QtWidgets.QPushButton(self.centralwidget)
          self.dock.setGeometry(QtCore.QRect(-1, 280, 777, 30))
          self.dock.setText("+")
          self.dock.setObjectName("dock")
          #
          self.apply.clicked.connect(self._big)
          self.reref.clicked.connect(self._small)
  
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def _big(self):
          self.resize(775,780)
      def _small(self):
          self.resize(775,340)
  
      def start(self):
          import sys
          if not QtWidgets.QApplication.instance():
              app = QtWidgets.QApplication(sys.argv)
          else:
              app = QtWidgets.QApplication.instance()
          app.aboutToQuit.connect(app.deleteLater)
          VolatilityManager = QtWidgets.QMainWindow()
          ui = MainWindow()
          ui.setupUi(VolatilityManager)
          VolatilityManager.show()
          sys.exit(app.exec_())
  
  
  if __name__ == "__main__":
      mw = MainWindow()
      mw.start()
  </code></pre>