Mar-07-2017, 10:13 PM
If you have a master class, you could do it like this:
Without a top you can do cross linking:
Of course, this is just broadcasting to everything. If your windows have different roles, you could just make an attribute for each role to fine tune the communication.
class Top(object): def __init__(self, n): self.bottoms = [Bottom(self) for bottom in range(n)] def send(self, data): for bottom in self.bottoms: bottom.receive(data) class Bottom(object): def __init__(self, top): self.top = top self.data = [] def receive(self, data): self.data.append(data) def send(self, data): for bottom in self.top.bottoms: if bottom != self: bottom.receive(data)This way the Bottom instances can send data to each other through their link to the Top instance. The Top instance can also send data down to the Bottom instances. You could add a send_up method to the Bottom class so Bottoms could send data to the Top.
Without a top you can do cross linking:
class Side(object): def __init__(self): self.siblings = [] self.data = [] def link(self, side): self.siblings.append(side) side.siblings.append(self) def receive(self, data): self.data.append(data) def send(self, data): for sibling in self.siblings: sibling.send(data) sides = [] for side in range(3): new_side = Side() for other in sides: new_side.link(other) sides.append(new_side)Here the Side instances can send data to each other through their cross linkages.
Of course, this is just broadcasting to everything. If your windows have different roles, you could just make an attribute for each role to fine tune the communication.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures