<span class="gmail_quote"></span>Hi. I tried to understand the MVC architecture from a simple example: a button.<br>The View must be only the clickable button<br>The Control must be the event listener on the button<br>The Model must be the action of the button.
<br><br>this is a simple (working but NON MVC) button<br><pre>from wxPython.wx import *<br><br>class MyApp(wxApp):<br> def OnInit(self):<br> dlg = wxDialog(None, -1, "")<br><br> ID_BTN = wxNewId()
<br><br> btn = wxButton(dlg, ID_BTN, "Click HERE")<br> EVT_BUTTON(self, ID_BTN, self.OnClick)<br><br> dlg.ShowModal()<br> dlg.Destroy()<br> return 1<br><br> def OnClick(self, event):
<br><br> wxMessageBox("Hello WORLD!!")<br><br>app = MyApp()<br>app.MainLoop()</pre>I would have Model class, View class and Controller class that implement this simple button. <br>The MVC must use Observer pattern. The code of
observer.py is Python translation of GOF Observer code.<br>I tried to do it, but this doesn't work (I can't use the Observer Pattern in MVC...) . I attach my work. Could you look at my work and suggest me where are my errors? Thanks all!
<br clear="all"><br>If we can complete this MVC simple implementation we could publish this like a "MVC SIMPLE TUTORIAL" because with only a button this could explain the MVC Observer based Architecture.<br><br>
Thanks all.<br><br>-- <br><span class="sg">Sbaush
</span><br clear="all"><br>