Answers for "tkinter draw box"

1

tkinter draw squaer

from Tkinter import *
master = Tk()

w = Canvas(master, width=250, height=200)
w.create_rectangle(0, 0, 100, 100, fill="blue", outline = 'blue')
w.create_rectangle(50, 50, 100, 100, fill="red", outline = 'blue') 
w.pack()
master.mainloop()
Posted by: Guest on February-20-2020
1

how to draw polygon in tkinter

from tkinter import *

root = Tk()

c = Canvas(root)
c.pack()

points = [x1,y1, x2,y2, xn,yn]
c.create_polygon(points)

root.mainloop()
Posted by: Guest on July-01-2020

Python Answers by Framework

Browse Popular Code Answers by Language