wxPython about event function

Hans Nowak hans at zephyrfalcon.org
Sat May 22 13:10:38 EDT 2004


RolleXu wrote:

> class container(wxPanel):
>     self.compnt is a control
> 
> the event func:
> 
> EVT_LEFT_DOWN(self,self.OnLeftDown)
> 
> when click container
>     self.OnLeftDown will be called
> when click self.compnt
>     self.OnLeftDown won't be called
> 
> please tell me
> why?
> and how to call the func, both case?

Well, you attach the event to 'self', which is the container.  You probably want:

   EVT_LEFT_DOWN(self.compnt, self.OnLeftDown)

HTH,

--
Hans Nowak (hans at zephyrfalcon.org)
http://zephyrfalcon.org/




More information about the Python-list mailing list