title: _tkinter.TclError: bad window path name
body: <p>I am making an application that involves tkinter, and will eventually involve sockets. My code currently consists of this:</p>
  
  <pre><code>import tkinter as tk # imports tkinter module
  from tkinter import * # imports tkinter module
  
  a=tk.Tk()
  a.title('Custodian Alert Tool')
  List=['','','']
  List.clear()
  
  def Clear():
              for widget in a.winfo_children(): # clears the window for the next Page
                          widget.destroy()
  
  def Home():
              Clear()
              Label(a,text='Welcome to the Custodian Alert Tool.').pack()
              Label(a,text='').pack()
              SubmitButton=tk.Button(a,text='Submit A Ticket',command=Submit)
              SubmitButton.pack()
              ExitButton=tk.Button(a,text='Exit',command=Exit)
              ExitButton.pack()
              a.mainloop()
  
  def Submit():
              Clear()
              def Append1(): # the button calls this function when pressed
                          List.append(x.get())
                          Gender()
              Label(a,text='Which bathroom are you reporting for?').pack()
              f=tk.Frame(a)
              f.pack()
              x=tk.StringVar()
              E=tk.Entry(f,textvariable=x)
              E.grid(row=1,column=1)
              b1=tk.Button(f,text='Submit',command=Append1) # the error occurs after I click this button
              b1.grid(row=1,column=2)
  
  def Gender():
              Clear()
              def Append2(y):
                          List.append(y)
                          Issue()
              Label(a,text='Boys or Girls?').pack()
              f=tk.Frame(a)
              f.pack()
              b1=tk.Button(f,text='Boys',command=Append2('Boys'))
              b1.grid(row=1,column=1)
              b2=tk.Button(f,text='Girls',command=Append2('Girls'))
              b2.grid(row=1,column=2)
  def Issue():
              Clear()
  
  
  def Exit():
              a.destroy()
  
  Home()
  </code></pre>
  
  <p>When I click the b1 button under the Submit function, however, I get this:</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 1550, in __call__
      return self.func(*args)
    File "/Users/skor8427/Desktop/AlertClient.py", line 27, in Append1
      Gender()
    File "/Users/skor8427/Desktop/AlertClient.py", line 45, in Gender
      b1=tk.Button(f,text='Boys',command=Append2('Boys'))
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 2209, in __init__
      Widget.__init__(self, master, 'button', cnf, kw)
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 2139, in __init__
      (widgetName, self._w) + extra + self._options(cnf))
  _tkinter.TclError: bad window path name ".4610182280"
  </code></pre>
  
  <p>This is the biggest error I have ever gotten and I have no clue where to begin. Anyone know what I can do?</p>