title: Tkinter: all radio buttons are selected
body: <p><img src="https://i.stack.imgur.com/XD5x3.png" alt="screenshot of popup window showing most radiobuttons pre-selected"></p>
  
  <p>Why in this code when clicking a button when a new window opens, all the radio buttons are selected?</p>
  
  <pre><code>class CodeButton:
      def __init__(self, root):
          self.btn = Button(root, text="Code",width=20, height=1,bg="white", fg="black")
          self.btn.bind("&lt;Button-1&gt;", make_code_window)
          self.btn.pack() 
  
  
  def make_code_window(event):
      new_root = Toplevel()
      new_root.minsize(width=300, height=300)
      var = IntVar()
      var.set(0)
      for i in range(8):
          Radiobutton(new_root, text=str(i), variable=var, value=i).pack()
  
  
  def main():
      root = Tk()
      root.minsize(width=400, height=250)
      CodeButton(root)
      root.mainloop()
  </code></pre>