Subclassing overriding 'parent' and retrieving it in instantiation
Hi community !
this title is very confusing but i couldn't really figure out how to name this post.
My problem is simple
I have a subclass
class TaskWidget(QtGui.QWidget): def __init__(self, taskName, parent=None): super(TaskWidget, self).__init__(parent)
when sublclassing it :
self.taskTemplate = TaskWidget(taskName, parent=aWidget) self.taskTemplateLayout.addWidget(self.taskTemplate)
then in my class definition I would have thought that :
print self # return the subclassed widget OK print self.parent() # should return aWidget ?
but it raises an error : # TypeError: 'aWidget' object is not callable
I m trying to go through the hierarchy so I can find a specific Widget.
Is that the proper way of doing it ?
What happens if you just do
I found out.
stupid mistake, I was overiding self.parent = parent in my init() ...