I have a rather specific question in Python.
I know the solution for constantly recieving the mouse coordinates on a frame in Tkinter:
import Tkinter as tk
root = tk.Tk()
def motion(event):
x, y = event.x, event.y
print('{}, {}'.format(x, y))
root.bind('<Motion>', motion)
root.mainloop()
My question is now combining a button pressed and the motion event. In a nutshell: I want the mouse coordinates only when the button is pressed, not when it's released or not pressed.
def ButtonPress(event):
#This is the part, where I can't figure out, how to proceed.
#How can I call the motion event from here.
Bt = Button(root, text='Press for coordinates!')
Bt.bind('<ButtonPress>', ButtonPress)
Regards!