OnFileOpent(self, event):

Frank Niessink niessink at serc.nl
Sun Jun 15 13:31:36 EDT 2003


On Fri Jun 13 13:17:44 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,

If you want to have it both as an event handler and call it
directly, you could define the function as below:

def OnFileOpen(self, event=None):
    ...

event is now an optional argument. wxPython can call it with an 
event as argument as before. And you can call it like this:

app.OnFileOpen() 



HTH, Frank

-- 
Nothing travels faster than the speed of light with the possible exception 
of bad news, which obeys its own special laws.
	-- Douglas Adams, 'Mostly Harmless'





More information about the Python-list mailing list