[wxpython-users] dynamic vs. static event binding in a custom popup menu class

Olga Marchevska olga.marchevska at gmail.com
Sun Apr 6 08:15:54 PDT 2008


Hello,

Please help me with a couple of related questions:

- Aren't event handlers unbound automatically when a window is destroyed?

- If yes, is there a difference for handlers bound to the event source 
window: 		
     window.Bind(event, func)
and handlers bound to some parent window or frame:
     ParentWindow.Bind(event, func, window)?

--
Thanks,
Olga Marchevska

-------- Original Message  --------
Subject: Re:[wxpython-users] dynamic vs. static event binding in a 
custom	popup	menu class
From: Robin Dunn <robin at alldunn.com>
To: wxpython-users at lists.wxwidgets.org
Date: Fri Apr 04 2008 02:40:20 GMT+0400

> Tim Black wrote:
> 
>> It seems to me that the negative performance impact of binding each 
>> time the
>> popup is created would be minimal, and that the benefit gained from
>> encapsulating all menu-related stuff in the PopupMenu class outweighs 
>> this. The
>> possible downside to 0. is that I don't know how to unbind events each 
>> time the
>> popup menu is destroyed so that I don't get a leak in the window's 
>> event handler
>> table. 
> 
> 
> There is an Unbind method that takes the same parameters as the Bind 
> method except you don't pass the handler function.  Or you can just use 
> Bind and pass None for the handler function.
> 
> 


More information about the wxpython-users mailing list