title: How can I set a radio button as default?
body: <p>How can I set a radio button as default? I have already searched several threads and tried different methods but nothing seems to work.</p>
  
  <pre class="lang-py prettyprint-override"><code>    #variable is a given string
      import tkinter as tk
  
      root = tk.Tk()
      root.withdraw()
      win = tk.Toplevel()
      a = tk.IntVar()
      a.set(1)
  
      tk.Label(win, text = "String").grid(row = 0, sticky = "w")
      tk.Label(win, text = "String").grid(row = 1, sticky = "w")
      e1 = tk.Entry(win)
      e1.insert(tk.END, variable)
      e1.grid(row = 0, column = 1)
      e2 = tk.Entry(win)
      e2.insert(tk.END, variable)
      e2.grid(row = 1, column = 1)
      tk.Label(win, text = "String").grid(row = 2, sticky = "w")
      start = tk.Radiobutton(win, text = "String", variable = a, value = 1, command = function1)
      start.grid(row = 2, column = 1)
      start.invoke()
      tk.Radiobutton(win, text = "String", variable = a, value = 2, command = function2).grid(row = 2, column = 2)
      tk.Radiobutton(frame, text = "String", variable = a, value = 3, command = function3).grid(row = 2, column = 3)
  </code></pre>