Python PyQT4 - Adding an unknown number of QComboBox widgets to QGridLayout
Posted
by ZZ
on Stack Overflow
See other posts from Stack Overflow
or by ZZ
Published on 2009-10-30T02:18:25Z
Indexed on
2010/05/05
20:38 UTC
Read the original article
Hit count: 385
Hi all,
I want to retrieve a list of people's names from a queue and, for each person, place a checkbox with their name to a QGridLayout using the addWidget() function. I can successfully place the items in a QListView, but they just write over the top of each other rather than creating a new row. Does anyone have any thoughts on how I could fix this?
self.chk_People = QtGui.QListView()
items = self.jobQueue.getPeopleOffQueue()
for item in items:
QtGui.QCheckBox('%s' % item, self.chk_People)
self.jobQueue.getPeopleOffQueue() would return something like ['Bob', 'Sally', 'Jimmy'] if that helps.
© Stack Overflow or respective owner