title: How to adjust height & width of a widget to the window size?
body: <p>I am working on a project where I am making a UI in <code>qt designer</code> and writing its code in <code>python</code>. I haven't set any height and width properties of ui widget or window in qt designer. When I am starting it, its not covering the whole window. Below is the code:</p>
  <p><strong>app.py</strong></p>
  <pre><code>import sys
  from PyQt5.QtWidgets import QApplication, QMainWindow
  from ui.test import Ui_MainWindow
  
  class Login(QMainWindow, Ui_MainWindow):
      def __init__(self):
          QMainWindow.__init__(self)
  
          self.ui = Ui_MainWindow()
          self.ui.setupUi(self)
  
  app = QApplication(sys.argv)
  main_window = Login()
  main_window.show()
  sys.exit(app.exec_())
  </code></pre>
  <p><strong>test.py</strong> (which has been converted from test.ui)</p>
  <pre><code>from PyQt5 import QtCore, QtGui, QtWidgets
  
  
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName(&quot;MainWindow&quot;)
          MainWindow.resize(1177, 480)
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName(&quot;centralwidget&quot;)
          self.table_widget = QtWidgets.QTableWidget(self.centralwidget)
          self.table_widget.setGeometry(QtCore.QRect(10, 10, 1161, 421))
          self.table_widget.setRowCount(20)
          self.table_widget.setColumnCount(20)
          self.table_widget.setObjectName(&quot;table_widget&quot;)
          MainWindow.setCentralWidget(self.centralwidget)
  
          self.retranslateUi(MainWindow)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def retranslateUi(self, MainWindow):
          _translate = QtCore.QCoreApplication.translate
          MainWindow.setWindowTitle(_translate(&quot;MainWindow&quot;, &quot;MainWindow&quot;))
  
  
  if __name__ == &quot;__main__&quot;:
      import sys
      app = QtWidgets.QApplication(sys.argv)
      MainWindow = QtWidgets.QMainWindow()
      ui = Ui_MainWindow()
      ui.setupUi(MainWindow)
      MainWindow.show()
      sys.exit(app.exec_())
  </code></pre>
  <p>When I am starting the code, it looks like below:</p>
  <p><a href="https://i.stack.imgur.com/xILMz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xILMz.jpg" alt="enter image description here" /></a></p>
  <p>In above image I can move the scroll bar to see all the rows and columns but if I click on maximize window it looks like below:</p>
  <p><a href="https://i.stack.imgur.com/CrPin.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CrPin.jpg" alt="enter image description here" /></a></p>
  <p>But in above image height and width remains same. How can I make it full screen so that widget height and width matches with the window size. Please help. Thanks</p>