Subclassing overriding 'parent' and retrieving it in instantiation
Moved
Solved
Language Bindings
-
Hi community !
this title is very confusing but i couldn't really figure out how to name this post.
My problem is simpleI 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
print self.parent
?