M
M
michadimin2021-07-18 02:45:49
PyQt
michadimin, 2021-07-18 02:45:49

How to get text from QListWidget?

Just explain please. I didn’t look anywhere - everywhere they write methods with "listWidget.selectedItems" or "currentItem", and then they translate it all into text using the variable into which they wrote the value and ".text()", but it doesn't work for me! Or is it something I don't understand.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bbkmzzzz, 2021-07-18
@bbkmzzzz

QListWidget contains QListWidgetItem , which already has text (if no widgets have been added)
To get the text, you need:

  • Get the index of the QListWidgetItem that is selected
  • Get QListWidgetItem by index
  • Get the text using the text method

Show the code, without the code, only such answers will be

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question