hi guys.. i want to disable a button in tkinter (this mean i can't click on that button) for 3 seconds if the user has already clicked on that button. how can i do that?

Here is an example ...

# disable a Tkinter button for a set time

import Tkinter as tk

def disable():
    # 'normal' enables button again
    button['state'] = 'disabled'
    # enable button again after 3000 milliseconds
    button.after(3000, enable)
    
def enable():
    button['state'] = 'normal'
 
root = tk.Tk()

# disabled only works with command, not bind!
button = tk.Button(root, text=" Press Button ", command=disable)
button.pack()

root.mainloop()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.