Drew, I've cc'd this to the floatcanvas list, so it will be in the archive, and maybe somone else has input:
http://mail.paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas On Sat, May 4, 2013 at 2:23 AM, Andrew Crawford <[email protected]>wrote: > I am wondering if it is possible to redraw only part of a canvas. > > I have a canvas with a large amount of objects, and I am moving an object > that is very small to a new position. As it stands, moving the object is > very slow, because it requires the canvas to be completely redrawn. > However, if I was able to redraw only the area behind the old and new > position of the object, it would be very fast. > > Currently, FloatCanvas checks to see which objects overlap the bounding box of the current viewport, and only draws those. It wouldn't be too big a modification, to set a "dirty" region, and have it check that to see what needs re-drawing -- though you'd also want to make sure only that region actually got drawn to. However, that would be a bit of work, and the canvas would still need to loop through all objects to see if they need to be drawn -- which can take a little while for a lot of objects. Alternatively, you can use the "foreground" layer -- that's what it's for -- if you put an object on the foreground, and change it, only the foreground needs to be re-drawn, not everything else. I suspect that that would work well for your use case. This is done in a number of the demos: Animation.py BouncingBall.py MovingPlot.py PolyEditor.py a few others... I've enclosed BouncingBall.py -- I think it's kind of fun -- take a look at line 126, where the Ball object is added to the canvas. HTH, -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]
BouncingBall.py
Description: Binary data
_______________________________________________ FloatCanvas mailing list [email protected] http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas
