0

im having a problem on my mini project.

i have a method here

def PrintClick(self,name = ""):
    print name

then i have a list widget named lstStudents

how do i call the method PrintClick when i click an item inside lstStudents? also how do i pass the parameters?

i tried

self.connect(self.ui.lstStudents,QtCore.SIGNAL("clicked()"), self.PrintClick)

but i doest work. please help me :(

1 Answer 1

2

You usually call the event when the list selection changes. Also, I'd use the new-style event signals. They look nicer:

self.ui.lstStudents.currentItemChanged.connect(self.PrintClick)
Sign up to request clarification or add additional context in comments.

2 Comments

hi this works great, thank you.. but how do i pass a parameter? please help me on it too ty.
hi i already figure it out. thanks just use .text() to show the clicked item

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.