I know that there is command attribute available for button widget,but it is not available for label widget.I need to perform certain action when a label is clicked on root window.Is there any possible way to do this?
            Asked
            
        
        
            Active
            
        
            Viewed 3,843 times
        
    1 Answers
4
            
            
        You can use label.bind("<Button-1>", ...:
import tkinter as tk
def command(event):
    print("hi")
root = tk.Tk()
label = tk.Label(text="Click me!", width=50, height=10, master=root)
label.pack()
label.bind("<Button-1>", command)
        rassar
        
- 5,412
 - 3
 - 25
 - 41