canvas.py
#!/usr/bin/env python3
from tkinter import *
root = Tk()
root.title("Canvas")
root.geometry("500x500+10+100")
root.configure(bg='bisque')
can_height = 300
my_canvas = Canvas(root,width=300, height=can_height, bg='white')
my_canvas.pack(pady=20)
#create Rectangle
#my_rectangle.create_line(x1, y1, x2, y2, fill="color")
my_canvas.create_rectangle(10, can_height-0, 200, can_height-100, fill="pink")
#create Oval
#my_canvas.create_oval(x1, y1, x2, y2, fill="color")
my_canvas.create_oval(10, can_height-0, 200, can_height-100, fill="cyan")
#create Line
#my_canvas.create_line(x1, y1, x2, y2, fill="color")
my_canvas.create_line(10, can_height-0, 200, can_height-100, fill="red")
root.mainloop()
No comments:
Post a Comment