Skip to main content

Canvas in Python Tkinter

 









from tkinter import *
rootk = Tk()
rootk.title("Home")   # set window title
 
rootk.geometry("500x300")

c = Canvas(rootk,width="500",height="300")
c.pack()

# x1,x2,y1,y2 set according to the geometry
# c.create_line(0,0,500,300,fill="red")
# c.create_line(0,300,500,0,fill= "black")


c.create_rectangle(3,5,400,200,fill="yellow")

# c.create_text(200,200,text="working")


# c.create_oval(0,300,500,0,fill= "gray")


rootk.mainloop()



Comments