OnFileOpent(self, event):

Peter Hansen peter at engcorp.com
Fri Jun 13 07:21:22 EDT 2003


MK wrote:
> 
> I have a question. How can I programmatically invoke the following
> function:
> 
>     def OnFileOpen(self, event):
> 
> For now, it gets called whenever I select File->Open menu,
> but I'd like to invoke it in my code. I'm using Python 2.2 and
> wxPython 2.4 on Win 2000. Thx,

Presuming you want to call it from within another method of the
object in which that method is defined (in other words, assuming
you have a "self" in some other method which refers to the 
object itself) you could possibly do this:

  self.OnFileOpen(event)

Now you may or may not need to specify "event" properly.  You
could just try with (None), or maybe an empty string '', but
that sort of thing probably works only if the method does not
actually use the event parameter internally.

More information might be needed to help further, but the
above at least covers the syntactual aspects.

-Peter




More information about the Python-list mailing list