Skip to main content

event in Python Tkinter

 




from tkinter import *
a = Tk()
a.title("Home")
a.geometry("500x300")

def ak(event):
    print(f"You clicked at x:{event.x}, y:{event.y}")
w = Button(a,text="Submit",font="Georgia 30 bold",bg="gray")
w.pack(padx="30",pady="30",ipadx=20,ipady=20)


# Here <Button-1>,<Double-1>(double click) are some event
w.bind('<Button-1>',ak)

w.bind('<Double-1>',quit)

a.mainloop()



Comments