title: How to freeze particular row / column in QTableWidget python?
body: <p>I have a QTableWidget generated by QTDesigner in which I want to,</p>
  
  <ol>
  <li>freeze particular row (row 0,1,2)</li>
  <li>freeze particular column (column 0)</li>
  </ol>
  
  <p>How can I get this going?</p>
  
  <p>EDIT: I think answer is available to implement in C++ but I am not able to make it work for python. <a href="https://doc.qt.io/qt-5/qtwidgets-itemviews-frozencolumn-example.html" rel="nofollow noreferrer">https://doc.qt.io/qt-5/qtwidgets-itemviews-frozencolumn-example.html</a></p>
  
  <p>I tried looking over some threads on stack over flow and some other platforms but none of them has answer for python. </p>
  
  <p><strong>Code Generated by Qtdesigner:</strong></p>
  
  <pre><code>from PyQt5 import QtCore, QtGui, QtWidgets
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.resize(428, 285)
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
          self.tableWidget.setGeometry(QtCore.QRect(20, 20, 391, 231))
          self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.AnyKeyPressed|QtWidgets.QAbstractItemView.DoubleClicked|QtWidgets.QAbstractItemView.EditKeyPressed|QtWidgets.QAbstractItemView.SelectedClicked)
          self.tableWidget.setRowCount(5)
          self.tableWidget.setColumnCount(3)
          self.tableWidget.setObjectName("tableWidget")
          item = QtWidgets.QTableWidgetItem()
          self.tableWidget.setHorizontalHeaderItem(0, item)
          item = QtWidgets.QTableWidgetItem()
          self.tableWidget.setHorizontalHeaderItem(1, item)
          item = QtWidgets.QTableWidgetItem()
          self.tableWidget.setHorizontalHeaderItem(2, item)
          self.tableWidget.horizontalHeader().setVisible(True)
          self.tableWidget.verticalHeader().setVisible(False)
          MainWindow.setCentralWidget(self.centralwidget)
          self.statusbar = QtWidgets.QStatusBar(MainWindow)
          self.statusbar.setObjectName("statusbar")
          MainWindow.setStatusBar(self.statusbar)
  
          self.retranslateUi(MainWindow)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def retranslateUi(self, MainWindow):
          _translate = QtCore.QCoreApplication.translate
          MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
          item = self.tableWidget.horizontalHeaderItem(0)
          item.setText(_translate("MainWindow", "Name"))
          item = self.tableWidget.horizontalHeaderItem(1)
          item.setText(_translate("MainWindow", "Age"))
          item = self.tableWidget.horizontalHeaderItem(2)
          item.setText(_translate("MainWindow", "City"))
  
  
  if __name__ == "__main__":
      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><strong>My Script:</strong></p>
  
  <pre><code>from PyQt5 import QtWidgets, QtCore
  from demo import Ui_MainWindow
  
  class DemoTable(QtWidgets.QMainWindow, Ui_MainWindow):                 
      def __init__(self):
          super(DemoTable, self).__init__()
          self.setupUi(self) 
  
  
  if __name__ == "__main__":
      import sys
      app = QtWidgets.QApplication(sys.argv)
      demowindow = DemoTable()   
      demowindow.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>Thanks!</p>