Advertisement
Felanpro

shapes and graphics

Aug 15th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. from tkinter import *
  2.  
  3. root = Tk()
  4. root.title("Application")
  5.  
  6. canvas1 = Canvas(root, width = 200, height = 150)
  7. canvas1.pack()
  8.  
  9. blackline = canvas1.create_line(0, 0, 200, 50) #-x, -y, x, y
  10. redline = canvas1.create_line(0, 100, 200, 50, fill = "red") #fill sets line to red.
  11.  
  12. green_rectangle = canvas1.create_rectangle(20, 35, 120, 60, fill = "green")
  13.  
  14. canvas1.delete(redline) #delete all: canvas1.delete(ALL)
  15.  
  16. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement