python - Unchecked radiobuttons when the program starts while the variable is StringVar -


here of radiobuttons checked when program starts. however, want none of them checked @ first, user can choose 1 of them:

from tkinter import * root = tk()  var = stringvar()  l = label(root) l.pack()  def f():     l.config(text=var.get())  rb1 = radiobutton(root, text="first", variable=var, value='a', command=f) rb1.pack()  rb2 = radiobutton(root, text="second", variable=var, value='b', command=f) rb2.pack() 

but not same intvar:

from tkinter import * root = tk()  var = intvar()  l = label(root) l.pack()  def f():     l.config(text=var.get())  rb1 = radiobutton(root, text="first", variable=var, value=1, command=f) rb1.pack()  rb2 = radiobutton(root, text="second", variable=var, value=2, command=f) rb2.pack() 

when run program works way want -- none of radiobuttons checked program starts , decide choose 1 of them.

but when variable stringvar, doesn't work out. want figure out why doesn't. i've looked solution in few sources, couldn't find helpful. decided ask here. appreciated!

you should able set radiobutton ' ' == "empty var" none selected, makes no sense mentioned @bryan oakley.

im not usre i'm within best practices adding values list creating radiobuttons, should allow have unselected radiobuttons

from tkinter import * root = tk()  def f():     l.config(text=var.get())  var = stringvar() var.set(' ')  #even without none value, allow empty radiobuttons on init. not recommended  values = ['none', 'a', 'b']  l = label(root, width=20) l.pack()  vset in values:     rb = radiobutton(root, text="first", variable=var, value=vset, command=f)     rb.pack()  root.mainloop()