I am using the following code to create a set of radiobuttons. The radiobuttons are created fine, but when it comes time to delete them, the buttons and text persist on screen. How do I go about ensuring that the radiobuttons get deleted?
import Tkinter
class App():
def __init__(self):
self.parent = Tkinter.Tk()
self.initialize()
self.parent.mainloop()
def initialize(self):
self.itemVar = "abc"
EVENS = [
('item0', 0),
('item2', 2),
('item4', 4),
('item6', 6),
('item8', 8),
('item10', 10),
('item12', 12),
('item14', 14),
]
r = 0
for text, mode in EVENS:
self.itemEvens = Tkinter.Radiobutton(self.parent, text=text,
variable=self.itemVar, value=mode)
self.itemEvens.grid(row =r, column=0)
r += 1
self.nextButton = Tkinter.Button(self.parent, text='Next',
command=self.nextScreen
self.nextButton.grid(row=9, column=0)
def nextScreen(self):
self.itemEvens.destroy()
self.questionLabel = Tkinter.Label(self.parent,
text='I need the radios gone')
self.questionlabel.grid(row=0, column=0)
if __name__ == "__main__":
app = App()