Skip to content
Advertisement

PyQt5 Python: How to go through Individual Row of Data from MySQL Query Result

I am trying to add item in a QComboBox in PyQt5 using Python. I am having problems in adding data from the SQL Query per row.

JavaScript

This results to only a single item added into the Combo Box:

JavaScript

What I want to happen in the ComboBox is like this (Add a total of 5 items in the Combo Box)

JavaScript

Edit:

JavaScript

Same Problem:

The appended Item added is still all the rows of data grouped into one.

Advertisement

Answer

After posting my question and tinkering on myself, I stumbled upon the answer to my question as I realized that I had to change the FOR LOOP statement to enumerate over the length of the data from MySQL Query Result and .addItem to the ComboBox before it goes on to the next tuple from the results from data (SQL Query Result).

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement