button with terms and conditions code example
Example: button with terms and conditions
from tkinter import *
def activate_submit():
if var.get()==1:
btn['state']=NORMAL
elif var.get()==0:
btn['state']=DISABLED
else:
print('something went wrong!')
ws = Tk()
ws.title("PythonGuides")
ws.geometry("400x300")
ws['bg']='#5d8a82'
var = IntVar()
cb = Checkbutton(
ws,
text="Terms & conditions",
onvalue=1,
offvalue=0,
variable=var,
font=("time", 16),
command=activate_submit,
bg='#5d8a82'
)
cb.pack(pady=50)
btn = Button(
ws,
text="Register",
command=None,
state=DISABLED,
padx=20,
pady=10,
relief=RAISED,
font=('times bold', 14)
)
btn.pack()
ws.mainloop()