I try to build a GUI with PyQt5 and currently I'm struggling with the following issue
I'd like to add a set of labels based on the items in a Dict
items: Dict = {'bli': False, 'bla': False, 'blub': False}
In fact the dict is much larger, but that shouldn't matter.
So I thought I can achieve this by just iterating through the Dict and add each element as a QLabel.
def createGroup(self) -> QGroupBox:    
    group: QGroupBox = QGroupBox("Status")
    layout = QVBoxLayout()
    for element in self.items:
        layout.addWidget(QLabel(element))
    group.setLayout(layout)
    return group
This QGroupBox is then added to another layout and that works fine so far.
The problem I now have is that I'd like to access these QLabels to e.g. change text.
The only way I've found so far is to do something like
myGroup: QGroupBox = self.createGroup()
for child in statusBox.children():
    if type(child) is QLabel:
        child.setText("buuuh")
Altough this works, this doesn't seem to be a proper way. How would one do this to have better access to child widgets created in such a way?
 
    