0

I want to create an application to backlog films. However, I have no idea how I would save user input to the QTableWidget. As in if I want to add text to the QTableWidget and come back to it later. Been struggling with it for awhile. Any help is appreciated. Here's what I have so far:

from PyQt5.QtWidgets import *
import sys

class Film(QWidget):
    def __init__(self):
        super(Film, self).__init__()

        self.center()
        self.setWindowTitle("Film backlog")

        self.resize(663, 700)
        layout = QGridLayout()
        self.setLayout(layout)

        tablewidget = QTableWidget(22, 6)
        tablewidget.setHorizontalHeaderLabels(["Name", "Air date", "Country", "Director", "Genre", "Link"])
        layout.addWidget(tablewidget)

        self.show()

    def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Film()
    sys.exit(app.exec_())

0 Answers0