[wxPython-users] wxPython and MVC

Peter Decker pydecker at gmail.com
Mon Dec 3 05:10:31 PST 2007


On Dec 2, 2007 5:15 PM, Mark Erbaugh <mark at microenh.com> wrote:
> I'm trying to develop applications along the lines of
> model-view-controller design.
>
> I think the frame class is the view portion. However, the event handling
> routines are part of the controller.  How do people separate them?

I think that the n-tier approach in Dabo is superior to MVC. The GUI
controls defer the logic to the business objects, and the results of
those business object methods (either modified values or raised
exceptions) are then reflected back in the GUI.

Events are necesarily at the UI level, so I usually have event handler
code in the UI that looks like:

def onSomeEvent(self, evt):
   self.PrimaryBizobj.doSomethingAboutTheEvent(evt)

If you are familiar with Design Patterns, this arrangement is the
Chain of Responsibilty pattern, in which objects either handle the
action themselves, or defer it up the chain where it will reach the
object that is responsible for dealing with the event or action.

-- 

# p.d.




More information about the wxpython-users mailing list