title: A Python tkinter smiley face with buttons that change gestures
body: <p>Update:
  I've managed to create functions for my code and a constructor. The only difficulty I've encountered is whenever I run my program, there's an error  <code>name 'SmileyFace' is not defined</code> when I believe I've defined it. I need help as to why <code>SmileyFace</code> isn't defined. Thanks</p>
  
  <pre><code>    from tkinter import *
  
  class SmileyFace:
      def __init__(self,righteye,mouth):
                  self.righteye=righteye
                  self.mouth=mouth
  
  
      def smile(self):
              global righteye, mouth
              c.delete(righteye)
              righteye = c.create_oval(225, 125, 275, 175, fill = 'black')
              c.delete(mouth)
              mouth = c.create_arc(125, 225, 275, 275, start = 0, extent = -180, width = 5, fill = "white")
  
      def sad(self):
              global righteye, mouth
              c.delete(righteye)
              righteye = c.create_oval(225, 125, 275, 175, fill = "black")
              c.delete(mouth)
              mouth = c.create_arc(125, 250, 275, 300, start = 0, extent = 180, width = 5, fill = "white")
  
      def wink(self):
              global righteye, mouth
              c.delete(righteye)
              righteye = c.create_line(225, 140, 250, 165, 275, 140, width = 5, smooth = "true")
              c.delete(mouth)
              mouth = c.create_line(125, 250, 275, 250, width = 5)
  
      def grin(self):
              global righteye, mouth
              c.delete(righteye)
              righteye = c.create_oval(225, 125, 275, 175, fill = "black")
              c.delete(mouth)
              mouth = c.create_line(125, 250, 200, 250, 275, 215, width = 5, smooth = "true")
  
      def main():
          global c
          win = Tk()
          c = Canvas(win, width = 800, height = 800)
          c.pack()
  
          c.create_oval(100, 100, 350, 350, outline = "black", fill = "yellow")
          eye1 = c.create_oval(125, 125, 175, 175, fill = "black")
          eye2 = c.create_oval(225, 125, 275, 175, fill = "black")
          mouth = c.create_line(125, 250, 275, 250, width = 5)
  
          Smiley = SmileyFace(righteye,mouth)
  
          Button(win,text='Smile',command=Smiley.smile).pack
          Button(win, text = "Sad", command = Smiley.sad).pack
          Button(win, text = "Wink", command = Smiley.wink).pack
          Button(win, text = "Grin", command = Smiley.grin).pack
          Button(win, text = "Quit", command = win.destroy).pack
  
      main()
  </code></pre>