I have a frame which holds 2 views. I want to use a common controller for both of them but not instantiate 2 controllers. How do i achieve this? Singleton? Send the controller as an argument?
This is what i want
First view
Class ViewAlpha
def __init_(self, parent):
self.controller = Controller()
def on_click(self, event):
self.controller.do_this(event.data)
Second view
Class ViewBeta
def __init_(self, parent):
self.controller = Controller()
def on_click(self, event):
self.controller.do_this(event.data)
Controller
Class Controller
def __init_(self):
self.client = Client()
def do_this(self, data):
self.client.store(data)
Aucun commentaire:
Enregistrer un commentaire