How can I fill a QComboBox?

0

Inside my GUI-Demo (qtpy and QtCreator) there's a QComboBox connected to a QPushButton.

Pressing the button opens my database and copies the data to my dataframe (pandas).

Afterwards, I am trying to pass the unique data from one of my columns into a list—which is added to my ComboBox.

Printing my dataframe in between tells me that it's filled correctly and I tried these lines of code in a few other places inside my program. But in this case it won't work and Python returns an error: Process finished with exit code -1073740791 (0xC0000409):

def pushTheButton(self):
    df = pd.DataFrame()
    try:
        db = pymysql.connect("localhost", "testuser", "test123", "database_test")
        cursor = db_load.cursor()
        sql_query = "SELECT * FROM database_favorites_db"
        cursor.execute(sql_query)
        db.commit()
        df = pd.read_sql(sql_query, db)

    except:
        db.rollback()

    db.close()


    list_unique = df.description.unique()
    self.ui.cBoxFavorites.addItems(listing_unique)

Why is this error being returned and how can I fix it?

python
mysql
qcombobox
asked on Stack Overflow Jan 24, 2020 by finethen • edited Jan 24, 2020 by S.S. Anne

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0