title: Confused by root vs self.root and the use of __init__. Also confused with definitions and classes
body: <p>first:</p>
  
  <pre><code>from tkinter import *
  
  
  self.root = Tk()
  self.root.configure(bg="red", padx=10, pady=10)
  self.root.title("WELCOME- PLEASE LOGIN)")
  
  name = Label(self.root, text="Name:", bg="magenta")
  password = Label(self.root, text="Password", bg="magenta")
  nameentry = Entry(self.root)
  passwordentry = Entry(self.root)
  
  name.grid(row=0, sticky=E)
  password.grid(row=1, sticky=E)
  nameentry.grid(row=0, column=1)
  passwordentry.grid(row=1, column=1)
  
  mainloop()
  </code></pre>
  
  <p>error on this code ( Traceback (most recent call last):
    File "/Users/me/pythonfolder/frametest.py", line 4, in 
      self.root = Tk()
  NameError: name 'self' is not defined)</p>
  
  <p>A window opens but is blank.</p>
  
  <p>Next:</p>
  
  <pre><code>from tkinter import *
  
  
  root = Tk()
  root.configure(bg="red", padx=10, pady=10)
  root.title("WELCOME- PLEASE LOGIN)")
  
  name = Label(root, text="Name:", bg="magenta")
  password = Label(root, text="Password", bg="magenta")
  nameentry = Entry(root)
  passwordentry = Entry(root)
  
  name.grid(row=0, sticky=E)
  password.grid(row=1, sticky=E)
  nameentry.grid(row=0, column=1)
  passwordentry.grid(row=1, column=1)
  
  mainloop()
  </code></pre>
  
  <p>This works fine.</p>
  
  <p>Why is using self.root causing an error vs just root?</p>
  
  <p>Also:</p>
  
  <pre><code>from tkinter import *
  
  
  def __init__(self, Event= None):
  
      root = Tk()
      root.configure(bg="red", padx=10, pady=10)
      root.title("WELCOME- PLEASE LOGIN)")
  
      name = Label(root, text="Name:", bg="magenta")
      password = Label(root, text="Password", bg="magenta")
      nameentry = Entry(root)
      passwordentry = Entry(root)
  
      name.grid(row=0, sticky=E)
      password.grid(row=1, sticky=E)
      nameentry.grid(row=0, column=1)
      passwordentry.grid(row=1, column=1)
  
  mainloop()
  </code></pre>
  
  <p>Causes this error using <strong>init</strong>:
      AttributeError: 'NoneType' object has no attribute 'tk'
  Using self.root in place of root causes the same error. Removing event= None also causes this error.</p>
  
  <p>Basically, I am confused on self.root vs root, definitions and their errors, and classes.</p>