Python
0
Вклад в тег
from tkinter import *
root = Tk()
canv = Canvas(root, width=1000, height=1000, bg="white")
canv.grid()
def b1(event):
x = event.x
y = event.y
canvas_id = canv.create_line(x, 0, x, 1000, width=1, fill='red')
canvas_id2 = canv.create_line(0, y, 1000, y, width=1, fill='red')
def b2(event):
canv.delete(canvas_id)
canv.delete(canvas_id2)
root.bind("<ButtonRelease>", b2)
root.bind('<ButtonPress>', b1)
root.mainloop()