Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- master = Tk()
- canvas_width = 200
- canvas_height = 100
- w = Canvas(master, width=canvas_width,
- height=canvas_height)
- w.pack()
- y = int(canvas_height / 2)
- w.create_line(0, y, canvas_width, y, fill="black")
- w.create_rectangle(50, 20, 150, 80, fill="black")
- w.create_rectangle(65, 35, 135, 65, fill="yellow")
- w.create_line(0, 0, 50, 20, fill="red", width=3)
- w.create_line(0, 100, 50, 80, fill="gold", width=3)
- w.create_line(150,20, 200, 0, fill="green", width=3)
- w.create_line(150, 80, 200, 100, fill="blue", width=3)
- mainloop()
- ************************************************************************
- from tkinter import *
- canvas_width = 200
- canvas_height =200
- python_green = "#476042"
- master = Tk()
- w = Canvas(master,
- width=canvas_width,
- height=canvas_height)
- w.pack()
- points = [100, 140, 110, 110, 140, 100, 110, 90, 100, 60, 90, 90, 60, 100, 90, 110]
- w.create_polygon(points, outline=python_green,
- fill='yellow', width=3)
- mainloop()
Advertisement
Add Comment
Please, Sign In to add comment