Python Forum
[PyQt] populate a QListWidget
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] populate a QListWidget
#2
Post the entire error message. Including the trace. You should not force others to read your code when you can easily provide a concise description of what the error is and where it happened.

The error is very clear. It expects an iterable(str), and you are passing a str. Do you have an iterable thing (like a list perhaps) of strs? You do.
self.listWidget.addItems(fruits)
If you really want to use a list to add items one at a time, you can use self.labelWidget.addItem(str).
Reply


Messages In This Thread
populate a QListWidget - by devilonline - Apr-10-2023, 01:11 AM
RE: populate a QListWidget - by deanhystad - Apr-10-2023, 02:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to get the color name of qlistwidget? flash77 5 1,279 Aug-13-2023, 07:01 PM
Last Post: flash77
  QListWidget, no item was selected flash77 4 989 Aug-02-2023, 09:31 AM
Last Post: Axel_Erfurt
  GUI Problem / call another function / fill QListwidget flash77 5 895 Jul-30-2023, 04:29 PM
Last Post: flash77
  [PyQt] [Solved]Populate ComboBox with for loop? Extra 3 2,156 Jul-31-2022, 09:01 PM
Last Post: Extra
  Problems getting tk Combobox contents to populate properly dford 4 3,839 Jan-08-2022, 02:39 PM
Last Post: dford
  Auto populate dictionary with names/values of QT widgets cjh 1 2,956 Mar-23-2021, 02:56 PM
Last Post: deanhystad
Question [PyQt] CSS Styling for a QLabel inside a QListWidget Alfalfa 2 5,160 Nov-30-2020, 02:59 AM
Last Post: Alfalfa
  [PyQt] How to populate a treeview on a GUI with a dictionary mart79 1 8,278 Aug-05-2019, 01:30 PM
Last Post: Denni
  Why QListWidget doesn't show new line? AlekseyPython 3 3,382 Feb-05-2019, 02:23 PM
Last Post: AlekseyPython
  populate list with images and be able to select them ricardons 0 2,137 Jan-11-2019, 03:45 PM
Last Post: ricardons

Forum Jump:

User Panel Messages

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