On 4/13/11 6:06 PM, [email protected] wrote: > Am reading the code in the demos to start using the FloatCanvas lib. I > need to use it for the zooming and clicking into images capabilities..
I've been away for the last couple weeks, so just got to this. > Right now I have a half-finished piece of code that works with wx.DC > [1], and I need to make the drawing "clickables" (if thats the correct > term) so if you have any suggestions it would be great.. Well, using FloatCanvas will let you make it both "clackable: and zoom and pan. But you do need to re-factor it to use floatcanvas object,s rather than a DC. FloatCanvas is an "object canvas". so rather than drawing commands, you create "DrawObjects" to represent your objects. YOU can then bind mouse events to the objects, change their properties, etc, and FloatCanvas takes care of the drawing itself for you. It comes with a bunch of general purpose DrawObjects (Circle, Polygon, Line, etc), or you can cretae your won by subclassing from an existing one, or subclassing from FloatCanvas.drawObject. There are a number of mix-ins that you can use to make it easy to make a new DrawObject. At first blush, I think I'd make a "Isometric Line" object, that would have the code that enforces the angle of the line correctly, so whne you set it's coordinates, it adjust them as need be. Take a look at the demos in: http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/FloatCanvas/Demos/ To get ideas. Each of those is a simple stand-alone program the demonstrates a feature or two. HTH, -Chris > Basically its a canvas to draw isometric lines with the mouse, if you > right click after drawing a X parallel or Y parallel line it gives you > the option to add curves (only the 90 bend option is working at this point) > > it needs a lot of more code to work properly but I didnt wanted to spent > more time in the DC so I started to learn how to use the FC > > PS: as I said the code is half-finished so expect bugs, plus am an > amateur python programmer, sorry if the code looks ugly or bad implemented. > [1] http://dl.dropbox.com/u/391810/Canvas%28withDC%29test.py > _______________________________________________ > FloatCanvas mailing list > [email protected] > http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas -- 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
