Question

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 :(

Was it helpful?

Solution

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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top