[PyQt] How to get a list of all items in QListWidget?

Dirk Reisnauer dirk.reisnauer at desys.de
Wed Apr 23 07:53:41 BST 2008


On Tue, 22 Apr 2008 21:43:05 +0200, Karlo Lozovina  
<karlo.lozovina at gmail.com> wrote:

> This should be trivial, but I'm stuck: how can I retrieve a list of
> QListWidgetItems, contained in a QListWidget? It seems I should use
> QListWidget.items() function, but I must be doing something wrong.
>
> Can anyone show a simple example?
>
> Thanks a lot...
>

try this...

items = []
for index in xrange(self.listWidget.count()):
     items.append(self.listWidget.item(index))


Ciao Dirk



More information about the PyQt mailing list