Tkinter Canvas, spline me!
Phlip
phlip_cpp at yahoo.com
Thu Oct 25 13:29:40 EDT 2001
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.
So I try this:
canv.create_polygon ( 5, 5, 50, 5,
50, 5, 100, 50,
100, 50, 150, 50,
splinesteps = 500,
smooth = 1 )
That creates a closed polygon - a nasty blob shaped like two filled
triangles pointing at each other. The "smooth" option enables the
"splinesteps" to sand off its corners, but this is hardly the effect I
needed.
Any tips?
--
Phlip phlip_cpp at yahoo.com
http://www.greencheese.org/HoneySatellite
-- DARE to resist drug-war profiteering --
More information about the Python-list
mailing list