title: Reading all the values from Qtablewidget in PyQt
body: <p>i have imported a QtableWidget in my Gui. I am a newbie in PyQt and Qt designer.
  I need to read the values entered in the cells in the QtableWidget.
  My existing code is given below.</p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  
   try:
       _fromUtf8 = QtCore.QString.fromUtf8
   except AttributeError:
        _fromUtf8 = lambda s: s
  
   class Ui_MainWindow(object):
       def setupUi(self, MainWindow):
           MainWindow.setObjectName(_fromUtf8("MainWindow"))
           MainWindow.resize(800, 600)
           self.centralwidget = QtGui.QWidget(MainWindow)
           self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
           self.tableWidget = QtGui.QTableWidget(self.centralwidget)
           self.tableWidget.setGeometry(QtCore.QRect(180, 80, 256, 192))
           self.tableWidget.setObjectName(_fromUtf8("tableWidget"))
           self.tableWidget.setColumnCount(2)
           self.tableWidget.setRowCount(3)
           item = QtGui.QTableWidgetItem()
           self.tableWidget.setVerticalHeaderItem(0, item)
           item = QtGui.QTableWidgetItem()
           self.tableWidget.setVerticalHeaderItem(1, item)
           item = QtGui.QTableWidgetItem()
           self.tableWidget.setVerticalHeaderItem(2, item)
           item = QtGui.QTableWidgetItem()
           self.tableWidget.setHorizontalHeaderItem(0, item)
           item = QtGui.QTableWidgetItem()
           self.tableWidget.setHorizontalHeaderItem(1, item)
           MainWindow.setCentralWidget(self.centralwidget)
           self.menubar = QtGui.QMenuBar(MainWindow)
           self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 25))
           self.menubar.setObjectName(_fromUtf8("menubar"))
           MainWindow.setMenuBar(self.menubar)
           self.statusbar = QtGui.QStatusBar(MainWindow)
           self.statusbar.setObjectName(_fromUtf8("statusbar"))
           MainWindow.setStatusBar(self.statusbar)
  
           self.retranslateUi(MainWindow)
           QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL(_fromUtf8("cellChanged(int,int)")), self.slot)
           QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
       def retranslateUi(self, MainWindow):
           MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
           item = self.tableWidget.verticalHeaderItem(0)
           item.setText(QtGui.QApplication.translate("MainWindow", "1", None, QtGui.QApplication.UnicodeUTF8))
           item = self.tableWidget.verticalHeaderItem(1)
           item.setText(QtGui.QApplication.translate("MainWindow", "2", None, QtGui.QApplication.UnicodeUTF8))
           item = self.tableWidget.verticalHeaderItem(2)
           item.setText(QtGui.QApplication.translate("MainWindow", "3", None, QtGui.QApplication.UnicodeUTF8))
           item = self.tableWidget.horizontalHeaderItem(0)
           item.setText(QtGui.QApplication.translate("MainWindow", "x", None, QtGui.QApplication.UnicodeUTF8))
           item = self.tableWidget.horizontalHeaderItem(1)
           item.setText(QtGui.QApplication.translate("MainWindow", "y", None, QtGui.QApplication.UnicodeUTF8))
  
       def slot(self):
           row= self.tableWidget.currentItem()
           print str(row)
  
   if __name__ == "__main__":
       import sys
       app = QtGui.QApplication(sys.argv)
       MainWindow = QtGui.QMainWindow()
       ui = Ui_MainWindow()
       ui.setupUi(MainWindow)
       MainWindow.show()
       sys.exit(app.exec_())
  </code></pre>
  
  <p>after running this program it i got an error in def slot(self).</p>