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.
On Wed, Dec 8, 2010 at 7:06 PM, Richard Fuhr <[email protected]> wrote: > Does the Tkinter Canvas class have built-in true cubic Bezier curve drawing > capability? > > I am relatively new to Python and have just recently started looking at > some of the methods associated with the Tkinter Canvas class. > > I see that Canvas has a create_line method, which can take a tuple of xi, > yi coordinates of points, and there is a smooth=True flag that can be set, > as well as a splinesteps value that can be set, which appears to control the > number of curve components. Or, is there some other Tkinter function > somewhere that would be more appropriate to use for drawing cubic Bezier > curves. > > Is the above use of the create_line method with smooth=True essentially the > same as the following code snippet, which illustrates how one could draw a > cubic Bezier curve on the Mac using Objective-C and the Cocoa framework? > > In particular, the Objective-C code snippets below would be part of what is > needed to draw a cubic Bezier curve whose control points are p[0], p[1], > p[2], p[3] > > NSBezierPath * cubicPath_ = [[NSBezierPath alloc] init]; > > [cubicPath_ moveToPoint:p[0]]; > [cubicPath_ curveToPoint:p[3] controlPoint1:p[1] controlPoint2:p[2]]; > > > // Draw the cubic path in red > [[NSColor redColor] set]; > [cubicPath_ stroke]; > > [cubicPath_ release]; >
