Python Forum
Need help adding a sql List to a combo box PyQt5
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help adding a sql List to a combo box PyQt5
#2
addItems takes a list, but you are passing a function instead. Try:

def pm_Combo(self):
        conn = sqlite3.connect('testdb.db')
        c = conn.cursor()
        c.execute("SELECT DISTINCT projectmanager FROM testtable2")
        pmList = c.fetchall()
        conn.commit()
        conn.close()
        return pmList
To make sure your variable is a list, you may verify the output of print(type(self.pm_Combo)) before the call to addItems.
Reply


Messages In This Thread
RE: Need help adding a sql List to a combo box PyQt5 - by Alfalfa - Jul-20-2018, 07:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Photo PySimpleGUI FilesBrowse enable event to update value in combo SamLiu 2 4,679 Mar-15-2023, 12:49 PM
Last Post: SamLiu
  How to update the list of a combo box in a QTableView panoss 10 6,321 Feb-05-2022, 03:24 PM
Last Post: panoss
  Radio butto to enable/disable combo box in Tkinter cybertooth 5 5,595 Oct-09-2021, 07:30 AM
Last Post: cybertooth
  PyQt5 adding image thewolf 3 3,334 Feb-21-2021, 08:28 PM
Last Post: thewolf
  Referencing Combo Box MC2020 6 2,984 Feb-12-2020, 10:17 PM
Last Post: woooee
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 2,859 Apr-06-2019, 11:15 PM
Last Post: ZenWoR

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020