[wxPython-users] Re: wxpython copy program help

Christopher Barker Chris.Barker at noaa.gov
Thu Feb 28 12:58:05 PST 2008


Tim Roberts wrote:
> However, when you created the tree controls, you specifically gave them 
> both an id of -1.  Thus, the second event here overwrites the first one, 
> and messages from BOTH windows get routed to onSelect_bot_Wind.

except that -1 is the value for "use a default ID". but this advise is 
still good:

> Forget about using IDs.  Your programs will be more readable if you use 
> "Bind" to manage events.  Replace those two lines with this:
> 
>        self.tree_1.Bind( wx.EVT_TREE_SEL_CHANGED, self.onSelect_top_Wind )
>        self.tree_2.Bind( wx.EVT_TREE_SEL_CHANGED, self.onSelect_bot_Wind )

And read:

http://wiki.wxpython.org/wxPython_Style_Guide

-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