title: Python tkinter error:'Variable is not defined" even though it is define
body: <p>When I run this code is says &quot;UserName is not defined even&quot; though its defined in the function right below it. Do the functions have to be a certain order and if so is there a way to fix that.</p>
  <pre><code>from tkinter import *
  
  def MasterLogin():
      Name = UserName.get()
      Email = RegisterEmail.get()
      Password = RegisterPassword.get()
      MasterLogin = Tk()
      MasterLogin.title('Login')
      MasterLogin.geometry('260x100')
      LoginEmail = Entry(MasterLogin, width=30).grid(row=0, column=1)
      LoginEmailText = Label(MasterLogin, text=Email).grid(row=0, column=0)
  
  def MasterRegister():
      MasterRegister = Tk()
      MasterRegister.title('Register')
      MasterRegister.geometry('260x100')
      UserName = Entry(MasterRegister, width=30).grid(row=0, column=1)
      UserNameText = Label(MasterRegister, text='Name ').grid(row=0, column=0)
      RegisterEmail = Entry(MasterRegister, width=30).grid(row=1, column=1)
      RegisterEmailText = Label(MasterRegister, text='Email ').grid(row=1, column=0)
      RegisterPassword = Entry(MasterRegister, width=30).grid(row=2, column=1)
      RegisterPasswordText = Label(MasterRegister, text='Password ').grid(row=2, column=0)
      RegisterCont = Button(MasterRegister, text='Continue', width=25, bg='blue', fg='white', 
                                                   command=MasterLogin).grid(row=3, column=1)
  </code></pre>