Ørjan Pettersen wrote: > I have been looking around in the demos and in the floarcanvas > documentation without any luck.
Sorry about the lack of documentation -- one of these days... > Is it possible to list all the shapes added to a canvas? Something like > print Floatcanvas.GetObjects() There are two lists of object on the canvas: FloatCanvas._DrawList FloatCanvas._ForeDrawList The underscore does sort of indicate that these are meant to be private, but there is no reason you can't use them. The reason it is there is that I don't want to guarantee that the internal method for keeping those won't change, but it hasn't in years. I suppose a getter for the whole set could be useful, but I've always kept a list myself if I want to do something with them in the future. > If I know the shape object, it's a MovingBitmap like in the demo, is it > possible to find the coordinates > to that shape on the canvas? Something like > MovingBitmap.GetCoordinates() og MovingBitmap.GetPosition(). Sure. Moving Bitmap inherits most of ScaledBitmap, so you get: ScaledBitmap.XY which is the (x,y ) coordinates of the bitmap. You can see this used in the ConnectorObjectMixin class. I think all DrawObjects are one of two types: - XYObject -- an object with a location defined by a single point: self.XY - PointsObject -- an object with a location defined by a set of points, like a polygon, self.Points (If I had been more thoughtful it would have been "self.Point" rather than "self.XY", but there you go!) Do poke into the source. Given the lack of docs, it's the only way to learn the API! The trick to all the DrawObjects is mix-ins -- most of them are built by mixing together a few mixin classes, and adding one or two specific methods--usually .__init__() and ._Draw(). Note: I'd love to use Sphinx to auto-generate docs -- anyone want to help set that up? -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
