Python GUI Tutorial - 19 - Canvas - create polygon | Tkinter

Опубликовано: 05 Октябрь 2024
на канале: Tech-Gram Academy
12,286
89

In this video, you're going to learn how we can create polygon using canvas's create_polygon method in Tkinter.

Polygon is a closed shaped made by some straight lines. To create polygon we have to give each vertices's coordinates used to draw a shape.

example -

from tkinter import *

root = Tk()
canvas = Canvas(width=800, height=600, bg='blue')
canvas.pack()
points = [250,110,480,200,280,280,250,110]
canvas.create_polygon(points, fill="green", outline="yellow" , width=3)
root.mainloop()




-----------------------------------------------------------------------

i am sure your queries like -
how to create a polygon on canvas in Tkinter?
how to create a triangle on canvas in Tkinter?
how to create a rectangle on canvas in TKinter?
how to draw polygon on canvas in TKinter?
what is polygon on canvas in TKinter?
how to use create_polygon method of canvas in TKinter?

have been solved.


if you've any problem related to this video then please let us know in comment box or contact us on facebook -

facebook -   / programmingcage