I 've made a class:
When I click on the button of the first GroupBox, I get it's children.
All ok.
But when I click on the button of the second GroupBox, I get the children of the first!
Like if there is one only instance of the class!
What have I done wrong?
from PyQt4 import QtGui
class myClass(QtGui.QGroupBox):
my_children = []
def __init__(self, parent):
QtGui.QGroupBox.__init__(self, parent)
self.button1 = QtGui.QPushButton('button1', self)
self.button1.clicked.connect(self.button1_clicked)
def button1_clicked(self):
print('my name is: ', self.objectName())
self.getChildren()
def getChildren(self):
if not self.my_children:
children = self.children()
for widget in children:
self.my_children.append(widget)
print('myClass:getChildren=', widget.objectName())
else:
print('full of children!! And they are:')
for widget in self.my_children:
print('myClass:getChildren=', widget.objectName())I promote two QGroupBoxes in to myClass:When I click on the button of the first GroupBox, I get it's children.
All ok.
But when I click on the button of the second GroupBox, I get the children of the first!
Like if there is one only instance of the class!
What have I done wrong?
