title: NameError: name 'var1' is not defined on Python
body: <p>Excuse me, I want<a href="https://i.stack.imgur.com/EWYRG.png" rel="nofollow noreferrer">enter image description here</a> to ask, I have a problem trying to find out the number of checkboxes, I have repaired it for 2 days but it has failed, I really ask for guidance and help to fix it so that it can run normally, by the way I have only learned python for 1 week, thank you</p>
  <p>this is my code:</p>
  <pre><code>def apa_bae():
      print(&quot;No.Rekam Medis: %d,\nNama Pasien: %d&quot; % (var1.get(), var2.get()))
  def alah():
      master = Tk()
      Label(master, text=&quot;Data Kuantitatif:&quot;).grid(row=0, sticky=W)
      var1 = IntVar()
      Checkbutton(master, text=&quot;No.Rekam medis&quot;, variable=var1).grid(row=1, sticky=W)
      var2 = IntVar()
      Checkbutton(master, text=&quot;Nama Pasien&quot;, variable=var2).grid(row=2, sticky=W)
      var3 = IntVar()
      Checkbutton(master, text=&quot;Tanggal Lahir&quot;, variable=var3).grid(row=3, sticky=W)
      var4 = IntVar()
      Checkbutton(master, text=&quot;Jenis Kelamin&quot;, variable=var4).grid(row=4, sticky=W)
      var5 = IntVar()
      Checkbutton(master, text=&quot;Kode Dokter&quot;, variable=var5).grid(row=5, sticky=W)
      var6 = IntVar()
      Checkbutton(master, text=&quot;Nama Dokter&quot;, variable=var6).grid(row=6, sticky=W)
      Button(master, text='Quit', command=master.quit).grid(row=7, sticky=W, pady=4)
      Button(master, text='Show', command=apa_bae).grid(row=8, sticky=W, pady=4)
      mainloop()
  </code></pre>