Tkinter Canvas, spline me!

Mitch Chapman chapman at bioreason.com
Thu Oct 25 14:15:05 EDT 2001


Phlip wrote:
> 
> Hot Nyp:
> 
> Thanks to the group for the answer to my last question here (whatever
> it was).
> 
> Today we enter a realm where the documentation for the Tk Canvas goes
> not.
> 
> Ogle this code:
> 
> from Tkinter import *
> canv = Canvas()
> canv.pack()
> canv.create_line(  5,  5,  50,  5)
> canv.create_line( 50,  5, 100, 50)
> canv.create_line(100, 50, 150, 50)
> mainloop()
> 
> A line with a dog leg in it, right?
> 
> I don't want straight lines or angles here. I want a nice smooth
> spline that starts at the first point, curves past the middle two, and
> ends at the end point.


Have you tried something like this? (Uh, I haven't; this is just
based on the Tk man pages :)

canv.create_line(5, 5, 50, 5, 100, 50, 150, 50,
                 smooth = 1)

-- 
Mitch Chapman
Mitch.Chapman at bioreason.com



More information about the Python-list mailing list