question: parameters for create_polygon() method

SeeBelow at SeeBelow.Nut SeeBelow at SeeBelow.Nut
Wed May 5 23:20:35 EDT 2004


Peter Otten wrote:
<snip>
> I just tried it - it may not be in the docs, but it does work.
> For example
> 
> import Tkinter as tk
> root = tk.Tk()
> canvas = tk.Canvas(root)
> canvas.pack()
> points = [(20, 20), (50, 150), (200, 50)]
> 
> canvas.create_polygon(fill="blue", *points)
> root.mainloop()
> 
> will draw a blue triangle.

Surprisingly, it works!  I tested it also.  It never occurred to me to
simply try the list of tuples in place of the normal arguments as
explained in the docs.   I just assumed that the docs were the full
story.

Yours is the best suggestion.

The suggestion about a flatten() function is also a good one, but it
turns out not to be needed.

Mitchell Timin

-- 
"Many are stubborn in pursuit of the path they have chosen, few in
pursuit of the goal." - Friedrich Nietzsche

http://annevolve.sourceforge.net is what I'm into nowadays.
Humans may write to me at this address: zenguy at shaw dot ca



More information about the Python-list mailing list