'GUI Programming isn't putting the Data into QTable Widget from SQL Query

I'm working on this coding project where we're to insert data from sql database into a qwidget table and I feel like my methodology

    def show_list_1(self):
        name = "movie_api.db"
        conn, curs = open_db(name)
        query = f"""SELECT t.full_title, t.rating, p.rankUpDown
                        FROM movie_headlines t
                        INNER JOIN pop_movies p 
                        ON t.id = p.id"""
        curs.execute(query)
        result = curs.fetchall()
        self.tableWidget.setRowCount(0)
        for row_number, row_data in enumerate(result):
            self.tableWidget.insertRow(row_number)
            for column_number, data in enumerate(row_data):
                self.tableWidget.setItem(row_number, column_number, QTableWidgetItem(data))
        conn.close()

This is what I'm working with and attached is what it looks like when run:

GUI  with Current Code



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source