Skip to content Skip to sidebar Skip to footer

How To Lock Tkinter Button After Pressing On It

how to lock the button after pressing on it, until the other button is pressed or until I closed the program interface?

Solution 1:

I'm not sure what you mean by locking the button, I think you mean disabling. Disabling is just you not being able to click the button until you define the state back to 'normal'

Here is some sample code:

from Tkinter import *

def doDisable():
    b2.configure(state=DISABLED)

root = Tk()
b2 = Button(root, text="Disable button", command=doDisable)
b2.pack()
root.mainloop()

Post a Comment for "How To Lock Tkinter Button After Pressing On It"