I am making a sort of todo app using tkinter. For this I want to generate checkbox dynamically and I have successfully done this using a function but I also want to delete those checkboxes when user press clear button. How can this be done.
name=Stringvar()
ent=Entry(root,textvariable=name).pack()
def clear(ent):
ent.pack_forget()
def generate():
k=name.get()
c=Checkbutton(root,text=k)
c.pack()
btn1=Button(root,text="Submit",command=generate)
btn1.pack()
btn2=Button(root,text="Clear",command=clear)
btn2.pack()
I want to delete the checkbox but I cannot do so as function clear does not read c.pack_forget()
Aucun commentaire:
Enregistrer un commentaire