I'm on python 2.7 using pyqt 4.10, I've created a QcomboBox
for items in item_all:
self.comboBox.addItem(items)
the item_all list is working perfectly but I need it to start with the default value as Empty (note that item_all list is being called from a DB table so I can't have an empty value to use it)
Another solution is self.comboBox.setCurrentIndex(-1). The QCombobox is blank when it is created without adding another item in the list.
Python 3.10 and PyQt6 6.5.1
Added a space to the item_all list before fetching it from the DB
item_all= ['',]
for items in c.fetchall():
item_all.append(items)
self.comboBox_2.clear()
self.comboBox_2.addItems(item_all)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With