Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- def checkered(canvas, line_distance):
- for x in range(line_distance,canvas_width,line_distance):
- canvas.create_line(x, 0, x, canvas_height, fill="#476042")
- for y in range(line_distance,canvas_height,line_distance):
- canvas.create_line(0, y, canvas_width, y, fill="#476042")
- ###############################################################################
- root = Tk()
- canvas_width = 1000
- canvas_height = 760
- w = Canvas(root,
- width=canvas_width,
- height=canvas_height)
- checkered(w,20)
- w.pack()
- a = int(canvas_height / 2)
- w.create_line(0, a, canvas_width, a,
- fill="black",width=3)
- b = int(canvas_width / 2)
- w.create_line(b, 0, b,canvas_height,
- fill = "red",width=3)
- w.create_text(5, ((canvas_height/2)-10)
- ,text="x",font=12)
- w.create_text(b+10 ,5
- ,text='y',font=12)
- w.create_text(b+10,a-10
- ,text='0',font=12)
- w.create_oval(b-5,a-5,b+5,a+5
- ,fill = 'black')
- w=int(canvas_width/50)
- z=int(canvas_width/100)
- aa=b+w
- bb=a-z
- cc=a+z
- w.create_line(aa,bb,aa,cc,
- fill='black',width=3)
- mainloop()
- line 37, in <module>
- builtins.AttributeError: 'int' object has no attribute 'create_line'
- a = int(canvas_height / 2)
- w.create_line(0, a, canvas_width, a,
- fill="black",width=3)
- b = int(canvas_width / 2)
- w.create_line(b, 0, b,canvas_height,
- fill = "red",width=3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement