Mar-04-2021, 11:44 PM
Hello everybody.
I am trying to dynamically change the text of a radio button.
Below is an example program. When you run it, when you click on the "Go" button, the text of the radiobutton is supposed to change.
When I run it, I get the error "NoneType" object does not support item assignment.
Any help would be appreciated.
Thanks in advance,
Ken
I am trying to dynamically change the text of a radio button.
Below is an example program. When you run it, when you click on the "Go" button, the text of the radiobutton is supposed to change.
When I run it, I get the error "NoneType" object does not support item assignment.
Any help would be appreciated.
Thanks in advance,
Ken
from tkinter import * from tkinter import filedialog import tkinter.font as font def main_program(): btn['text']="Go pressed" print("Finished\n") mw = Tk() mw.geometry('700x300+400+200') frame1 = Frame(mw) frame2 = Frame(mw) framebot = Frame(mw) frame1.pack(side=TOP,fill=X) frame2.pack(side=TOP,fill=X) framebot.pack(side=BOTTOM,fill=X) btn = Radiobutton(frame2,text='Press Go',font=("Times",16)).pack(side="left") btn3 = Button(framebot,text='Go',font=("Times",16),command=main_program).pack(side="left") btn4 = Button(framebot,text='Exit',font=("Times",16),command=mw.quit).pack(side="right") mw.mainloop()