question: parameters for create_polygon() method
Peter Otten
__peter__ at web.de
Wed May 5 02:50:24 EDT 2004
Andrew Bennetts wrote:
> Sorry, I misinterpreted the problem slightly; I just checked the docs for
> create_polygon and realised it takes an argument that is a sequence of
> co-ords, rather than a variable number of args that are the co-ords.
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.
Peter
More information about the Python-list
mailing list