title: sqlite3 table into QTableWidget, sqlite3, PyQt5
body: <p>I have created a program that manages tables in a database, now i'm trying to make a gui for it, and i figured the easiest way would be to do it with Qt Designer and then convert it to python with PyQt5, and so i did it, i know how to bind functions to buttons, but i don't know more complicated things like displaying table columns and rows into a Qtablewidget, suppose i have the database bellow:</p>
  
  <pre><code>import sqlite3
  conn = sqlite3.connect('realscheduler.db')
  c = conn.cursor()
  c.execute('pragma foreign_keys = ON;')
  conn.commit()
  </code></pre>
  
  <p>With a table named professors, with 6 columns in it, what do i do to display this table, its columns and its rows on the QtableWidget bellow?</p>
  
  <pre><code># -*- coding: utf-8 -*-
  
  # Form implementation generated from reading ui file 'testui.ui'
  #
  # Created by: PyQt5 UI code generator 5.4.1
  #
  # WARNING! All changes made in this file will be lost!
  
  from PyQt5 import QtCore, QtGui, QtWidgets
  
  class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.resize(800, 600)
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
          self.horizontalLayout.setObjectName("horizontalLayout")
          self.verticalLayout = QtWidgets.QVBoxLayout()
          self.verticalLayout.setObjectName("verticalLayout")
          self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
          self.tabWidget.setObjectName("tabWidget")
          self.tab = QtWidgets.QWidget()
          self.tab.setObjectName("tab")
          self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.tab)
          self.verticalLayout_2.setObjectName("verticalLayout_2")
          self.tableWidget = QtWidgets.QTableWidget(self.tab)
          self.tableWidget.setObjectName("tableWidget")
          self.tableWidget.setColumnCount(0)
          self.tableWidget.setRowCount(0)
          self.verticalLayout_2.addWidget(self.tableWidget)
          self.tabWidget.addTab(self.tab, "")
          self.tab_2 = QtWidgets.QWidget()
          self.tab_2.setObjectName("tab_2")
          self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.tab_2)
          self.horizontalLayout_2.setObjectName("horizontalLayout_2")
          self.tableWidget_2 = QtWidgets.QTableWidget(self.tab_2)
          self.tableWidget_2.setObjectName("tableWidget_2")
          self.tableWidget_2.setColumnCount(0)
          self.tableWidget_2.setRowCount(0)
          self.horizontalLayout_2.addWidget(self.tableWidget_2)
          self.tabWidget.addTab(self.tab_2, "")
          self.verticalLayout.addWidget(self.tabWidget)
          self.horizontalLayout.addLayout(self.verticalLayout)
          MainWindow.setCentralWidget(self.centralwidget)
          self.menubar = QtWidgets.QMenuBar(MainWindow)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
          self.menubar.setObjectName("menubar")
          MainWindow.setMenuBar(self.menubar)
          self.statusbar = QtWidgets.QStatusBar(MainWindow)
          self.statusbar.setObjectName("statusbar")
          MainWindow.setStatusBar(self.statusbar)
  
          self.retranslateUi(MainWindow)
          self.tabWidget.setCurrentIndex(1)
          QtCore.QMetaObject.connectSlotsByName(MainWindow)
  
      def retranslateUi(self, MainWindow):
          _translate = QtCore.QCoreApplication.translate
          MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
          self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Tab 1"))
          self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Tab 2"))
  </code></pre>