Saturday, August 14, 2010

chaco, traits callbacks, and garbage collection

i just learned something about traits (from enthought) the hard way.... if you allow the object that has a trait callback defined on it to drop all references to it (other than adding it to a container), the callback won't work. in my case, i had a lasso selection turned on for a chaco plot that was put into a HPlotContainer. it plotted just fine, interaction tools were fine.... but no reaction to the selection.
all i had to do was hang onto a reference to that traits object, and the selection worked. tough, tough bug to find. i feel cheated somehow.

No comments: