title: TclError: wrong # args error
body: <p>I have no idea what is wrong but I keep getting this</p>
  
  <blockquote>
    <p>Exception in Tkinter callback
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/lib-tk/Tkinter.py", line 1410, in <strong>call</strong>
        return self.func(*args)
      File "/Users/Zane/Desktop/Factorial GUI.py", line 72, in reveal2
        self.text2.insert(0.0, message)
      File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/lib-tk/Tkinter.py", line 2986, in insert
        self.tk.call((self._w, 'insert', index, chars) + args)
    TclError: wrong # args: should be ".22186144.22187184 insert index chars ?tagList chars tagList ...?"</p>
  </blockquote>
  
  <p>here is my code:`</p>
  
  <pre><code>from Tkinter import*
  
  class App(Frame):
  
  def fac(self, n):
  
      if n &gt;= 0:
          if n == 1 or n == 0:
              return 1
          else:
              return n*self.fac(n-1)
      else:
          print('Error')
  
  def per(self, n, r):
  
      y = (self.fac(n)) / self.fac(n - r)
      print (y)
  
  
  def __init__(self, master):
  
      Frame.__init__(self,master)
      self.grid()
      self.create_widgets()
  
  def create_widgets(self):
      self.instruction1 = Label(self, text = "Factorial:")
      self.instruction1.grid(row = 0, column = 0, columnspan = 1, sticky = W)
  
      self.password1 = Entry(self)
      self.password1.grid(row = 0, column = 1, sticky = W)
  
      self.submit_button1 = Button(self, text ="Enter", command = self.reveal1)
      self.submit_button1.grid(row = 2, column = 0, sticky = W)
  
      self.text1 = Text(self, width = 30, height = 1, wrap = WORD)
      self.text1.grid(row = 3, column = 0, columnspan = 2, sticky = W)
  
      self.instruction2 = Label(self, text = "Permutation:")
      self.instruction2.grid(row = 4, column = 0, columnspan = 1, sticky = W)
  
      self.password2 = Entry(self)
      self.password2.grid(row = 4, column = 1, sticky = W)
  
      self.password3 = Entry(self)
      self.password3.grid(row = 6, column = 1, sticky = W)
  
      self.submit_button2 = Button(self, text ="Enter", command = self.reveal2)
      self.submit_button2.grid(row = 7, column = 0, sticky = W)
  
      self.text2 = Text(self, width = 30, height = 1, wrap = WORD)
      self.text2.grid(row = 8, column = 0, columnspan = 2, sticky = W)
  
  def reveal1(self):
  
      y = int(self.password1.get())
  
      message = self.fac(y)
  
      self.text1.delete(0.0, END)
      self.text1.insert(0.0, message)
  
  def reveal2(self):
  
      y = int(self.password2.get())
      z = int(self.password3.get())
  
      message = self.per(y, z)
  
      self.text2.delete(0.0, END)
      self.text2.insert(0.0, message)
  
  
  root = Tk()
  root.title('Factorial')
  root.geometry("340x300")
  app = App(root)
  
  root.mainloop()
  </code></pre>
  
  <p>`</p>