from Tkinter import *
def ShowPosition(event):
Top = Toplevel(root)
xlabel = Label(Top)
xlabel.pack()
xlabel.config(text = "X = " + str(event.x))
ylabel = Label(Top)
ylabel.pack()
ylabel.config(text = "Y = " + str(event.y))
Top.mainloop()
root = Tk()
frame = Frame(root, width=200, height=200)
frame.bind("<Button-1>", ShowPosition)
frame.pack()
root.mainloop()
|