Skip to content
Advertisement

How to get the text of the clicked item of Listwidget in PyQt5?

I was looking for a method to get a text/ name of the clicked element on a listWidget.

This was my approach looks like:

JavaScript

but it always crashes and gives me this error:

JavaScript

Could someone please tell me what Im doing wrong?

Advertisement

Answer

The signature of your slot lamp_clicked is wrong. Take a look at QListWidget::itemClicked and note that the signal has one parameter but your slot takes no parameter.

JavaScript

should do the trick.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement