I have a mouse listener:
from pynput.mouse import Listener, Button
def on_click(x, y, button):
if button == Button.left:
xy_dict["x"] = x
xy_dict["y"] = y
if button == Button.right:
raise MyException(button)
with Listener(on_click=on_click) as listener:
listener.join()
And I also have main()
function from other script. It is supposed that main()
takes x
and y
from mouse listener, but how can I unite these two threads?