On 12/9/10 9:15 AM, Richard Fuhr wrote:
Upon further investigation, it looks like wxPython has an API here (
http://www.wxpython.org/docs/api/wx.GraphicsPath-class.html#AddCurveToPoint
) that seems to closely resemble the curveToPoint method (from
Objective-C/Cocoa) for drawing cubic Bezier curves.  So perhaps wxPython
would be a better approach than Tkinter for conveniently drawing Bezier
curves.

Yup -- the relatively new wxGraphicsContext is a pretty powerful solution. However, it doesn't have many of the other nifty features of the Tk Canvas.

I wrote a higher-level Canvas on top of the older wxDC classes:

http://trac.paulmcnett.com/floatcanvas

It doesn't have a real Bezier spline built in, rather then older, less flexible wxDC spline. However, you could add it:

http://trac.paulmcnett.com/floatcanvas/wiki/SmoothLines

Or you could use the newer, but less tested FloatCanvas2 that is built on GraphicsContext:

http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/branches/FloatCanvas/SOC2008_FloatCanvas/floatcanvas2/

wx also has a wrapper around Cairo, that provides all of Cairo's rending abilities.

Of course, there are other reasons to choose wx or tk as well, which may (or may not) be more compelling.

 -- what is your use-case?


-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]

Reply via email to