from tkinter import *
r=Tk()
canvas=Canvas(r,width=1200,height=600)
canvas.pack()
def mouse(event):
x=event.x
y=event.y
canvas.create_text(x,y-15,text="( {},{} )".format(x , y))
canvas.create_oval(x-2,y-2,x+3,y+3,width=4) # 圓形
canvas.pack()
r.bind("<Button-1>",mouse)
r.mainloop()
沒有留言:
張貼留言