There is a swarm of objects. If a new one unit certain type appears on the frame, the swarm Integrate this object by calling some
add_new_unit Method. over swarm is a regulator Abstraction that treats several swarms of different types and the interaction with an image-processing abstraction that recognizes entities in the frame. over regulator is a GUI Layer.
I would like to add a new widget GUI every time a new one unit is added to that swarm, Essentially, I have to call a method from GUI Abstraction object from the swarmbut there are those regulator Object in the hierarchy between them.
What is a good approach in this case? I think about Observer, who will report about it regulatorwhich triggers a handler method each time it is observed
add_new_unit of swarm called. But in this case, I have to create Observer, which will report GUIThat will be watching regulatorObserver? Something tells me that there should be a better way to do this.
The language in question is Python 3.7