Here we are providing basic tutorial in Tkinter to intrduce mouse click events in your program.

Consider this code

from tkinter import *

root = Tk()

def leftClick(event):
    print("Left")

def rightClick(event):
    print("Right")

frame=Frame(root, width=300, height=250)
frame.bind("<Button-1>",leftClick)
frame.bind("<Button-2>",rightClick)
frame.pack()

root.mainloop()


In above code, two events are created, one for leftClick function and one for rightClick function. Then both are binded with their respective events. Rest code is self-explanatory.

Output

output


On clicking the left mouse button, output will appear on command window like this -


output


On clicking the right mouse button, output will appear on command window like this -