I am trying to work out an MVC structure for a tkinter program. I have a view class with an event binding for mouse click as follows:
class View(): def __init__(self, root) self.canvas = Canvas(root) self.canvas.pack() self.canvas.bind("<Button-1>", self.select) def select(self): # do some thing I have another class 'Controller' class Controller: def __init__(self, root): self.model = model.Model() self.view = view.View(self.model) #root.bind_class("Canvas", "<Button-1>", self.view.select) I need to move the event binding from view to the controller. How do I bind the canvas widget created in view class from the controller class? I have worked out a temporary solution in the controller class by binding the entire Canvas widget to the event using root.bind_class("Canvas", "<Button-1>", self.view.select). Any ideas would be appreciated. regards _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss