title: Tkinter StringVar error
body: <p>Hi i get an error with this code that StringVar() is not defined, and its probably a small thing but i am not that experienced with tkinter and would like some help, thanks.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>import tkinter as tk
  
  
  class Converter1(tk.Tk):
      def __init__(self):
          tk.Tk.__init__(self)
          self.entry = tk.Entry(self)
          self.variable = StringVar()
          self.variable.set("Miles to Kilometers") # default dropdown menu value
          self.menu = tk.OptionMenu(self, variable, "Miles to Kilometers", "Kilometers to Miles")
          self.button = tk.Button(self, text="Convert!", command=self.convertMK)
          self.button.pack()
          self.menu.pack()
          self.button.pack()
          self.entry.pack()
  
      def convtertMK(self): # converts the miles and kilometers using the dropdown menu
          if var.get() == "Miles to Kilometers":
              print(int(self.entry.get()) * 1.6093)
          else:
              print(int(self.entry.get()) / 1.6093)        
  
  
  
  converter = Converter1()
  </code></pre>
  
  <p>Here's the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/MaxBookPro/Desktop/test.py", line 25, in &lt;module&gt;
      converter = Converter1()
    File "/Users/MaxBookPro/Desktop/test.py", line 8, in __init__
      self.variable = Variable1
  NameError: global name 'Variable1' is not defined
  </code></pre>
  
  <p>Thanks again.</p>