Ørjan Pettersen wrote: > The problem was that I wasn't able to duplicate it. It was only a problem > in my code, and not in my smaller running sample.
Always a challenge! > You are correct. I'm reusing objects. Which I really intend to support! > I remove them from the canvas and put them back in > a controlled order. Which brings up another feature I've been meaning to add -- an API for moving the order of objects on the Canvas. If the only reason you have to Clearing and re-adding is to change the order, you may want to simply manipulate the _DrawList -- there should be an API for that, but since there isn't a hack may suffice. > I'm not sure if my temporary solution is viable, but it works, at least > for the small amount of > testing I have done so far. In FloatCanvas.ClearAll() > > def ClearAll(self, ResetBB=True, ResetHCG=True): > """ > ClearAll(ResetBB=True) > > Removes all DrawObjects from the Canvas > > If ResetBB is set to False, the original bounding box will remain > > """ > self._DrawList = [] > self._ForeDrawList = [] > self._BackgroundDirty = True > if ResetHCG: > self.HitColorGenerator = None > self.UseHitTest = False > if ResetBB: > self._ResetBoundingBox() > self.MakeNewBuffers() > self.HitDict = None That'll work -- the only issue is that if you don't reset the HitColorGenerator, and you do this a LOT with LOT of objects, you could run out of colors. > Or I could just save the HitColorGenerator object before calling the > ClearAll() function. > > hcg = canvas.HitColorGenerator > canvas.ClearAll() > canvas.HitColorGenerator = hcg > > Works fine to it seems. That should work too, and may be a better hack for you, as it doesn't require changing FloatCanvas itself. I'm still trying to think of a good general solution, though.... -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 [email protected] _______________________________________________ FloatCanvas mailing list [email protected] http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas
