Philip Peake wrote: Hi Phil, Welcome.
> I found some sample code where wx.Printout is working with a panel DC > with the methods: > getWidth(), getHeight() & DoDrawing(DC) > > Does anyone know the similar commands in Float Canvas? getWidth and getHeight() are no problem, but DoDrawing is a bigger mess. The short version: It's been on the list forever, but I haven't implemented Printing with FloatCanvas yet. The long version: In theory, it shouldn't be too hard. However, there are a few tricks: The scaling and shifting of the coordinates from World to Pixel is currently set up to be global to the FloatCanvas. However, your printer is likely to use a different DPI and size than the window, so you'll need to do that right. Here's a summary of what it should take: Essentially, "all" you need to do is write a "print" method that takes the PrintDC (and maybe a few other parameter). In that method, you loop through self._DrawList and then self._ForeDrawList, and call each DrawObject's _Draw() method. DrawObjects's _Draw methods take the following parameters: dc : the wx.DC to draw to WorldToPixel : A function that converts from World to Pixel coords ScaleWorldToPixel : A function that converts lengths in world Coords to lengths in pixel coords Those two scale functions are the trick -- they are defined as methods of the FloatCanvas class, and are updated as the canvas is re-sized, etc. You'll need to make versions that work for Printing. If you want to take this on, first get the latest version of the code from SVN: http://morticia.cs.dal.ca/FloatCanvas/ (if that's a real problem for you, we'll try to roll it up in a zip file or something for you, but SVN is a better option) Then take a look at floatcanvas/FloatCanvas.py -- look at the WorldToPixel method of the FloatCanvas class, and the FloatCanvas.Draw method -- that one is pretty ugly, full of various optimizations, but the essence is fairly simple: loop though the objects and draw them. Keep the questions coming! -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://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
