Answer
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root, bg="white", height=200, width=200)
canvas.pack()
points = [10, 10, 15, 30, 140, 10, 10, 100]
canvas.create_polygon(points, fill="red")
root.mainloop()
Work Step by Step
In this code, we first create the main window of the Tkinter application using the Tk() method and assign it to the variable root. Next, we create a canvas using the Canvas constructor, specifying the parent window as root and setting the background color to "white", the height to 200, and the width to 200. Then, we use the pack() method to display the canvas on the screen.
Next, we specify the points of the polygon as a list of coordinates [10, 10, 15, 30, 140, 10, 10, 100].
Finally, we use the create_polygon method of the canvas to draw a polygon using the specified points and fill color of "red". The polygon will be filled with the specified color.