Reputation: 1
I am writing a code and I need to create a reset button to uncheck all radio buttons and checkbuttons, i keep on getting this error; AttributeError: 'IntVar' object has no attribute 'delete'
here is the code i used in creating the reset button:
def resetbtn():
var.delete(0, END)
cv1.delete(0, END)
cv2.delete(0, END)
cv3.delete(0, END)
cv4.delete(0, END)
cv5.delete(0, END)
cv6.delete(0, END)
cv7.delete(0, END)
entry1.delete(0, END)
btn2= Button(root, text= 'Reset', command= resetbtn)
btn2.grid(row= 10, column=2)
mainloop()
Upvotes: 0
Views: 602
Reputation: 178
You can use deselect
property like here:
from tkinter import *
def resetbtn():
ch1.deselect()
ch2.deselect()
root = Tk()
ch1 = Checkbutton(root)
ch1.grid(row=10, column=1)
ch2 = Checkbutton(root)
ch2.grid(row=10, column=2)
btn2 = Button(root, text= 'Reset', command=resetbtn)
btn2.grid(row=10, column=3)
mainloop()
Upvotes: 0