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()
https://stackoverflow.com/questions/36906182/how-to-lock-tkinter-button-after-pressing-on-it/36909456#36909456
share
improve this answer