1

Is there a way to detect when the mouse is clicked on a Tkinter canvas in python, only using modules which are downloaded with the python package?

James T
  • 35
  • 1
  • 5

1 Answers1

3

I guess a possible answer would be

root = Tk()
canvas= Canvas(root, width=100, height=100)
canvas.bind("<Key>", key)
canvas.bind("<Button-1>", callback)
canvas.pack()

Where key and callback are functions you have to define yourself. From How to bind a click event to a Canvas in Tkinter?

Astrom
  • 767
  • 5
  • 20