[wxPython-users] Learning the MVP Pattern

Christopher Barker Chris.Barker at noaa.gov
Wed Nov 22 08:42:04 PST 2006


Rich Shepard wrote:
>>   def OnQuit(self, event):
>>       presenter.quitApp()
> 
>   That's the first way I had it written. The python error is, "TypeError:
> unbound method quitApp() must be called with presenter instance as first
> argument (got nothing instead)"

yes, but you've moved your error down a level -- at least the OnQuit 
method is being called successfully.

I'm not familiar with the presenter code, but it looks like in this 
case, presenter may be a class object, rather than an instance object.

>   And I've no idea how to instantiate the presenter class and use that
> instance in the call.

I'm guessing: presenter() ;-)

the trick is to store is somewhere -- globally in the module (probably 
not the best idea) in your app object, in the model object, etc.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list