Python Tutorial

What Are Mouse Clicking Events in Python Tkinter? [With Examples]

Understanding Mouse Clicking Events in Python Tkinter

So, to bind the event, we can utilize the bind() function of the button widget, which deals with events that occur when the button is pressed.


from tkinter import *

rt = Tk()

rt.title("Binding Events")


def clicked(event):

        label.config(text="Left button clicked")

ck = Button(rt, text="Click Here", font="ariel 15 bold", bg="black", fg="white")

ck.pack(padx=30, pady=10)

lab = Label(rt, text="", font="ariel 15 bold")

lab.pack(padx=30, pady=10)

ck.bind("", clicked)

Did you find this article helpful?