title: TypeError: delete() missing 1 required positional argument: 'indexPosition'
body: <p>I'm trying to create a simple customer registration program where a table pops in when I click a button named &quot;<em>saved</em>&quot; using a list that gets updated by doing the same. I'm also making a <code>delete</code> function that would delete a selected row via mouse click, I tied this function to a callback function that would set the text in a text field (<code>cName</code>, <code>cEmail</code>, <code>birthdate</code>). My problem is that whenever I would click the delete button it shows up an error-- <strong>TypeError: delete() missing 1 required positional argument: 'indexPosition'</strong> I tried using different passing methods from one function to another but I'm still stumped.</p>
  <p>My code:</p>
  <pre><code>from tkinter import *
  from tkinter import messagebox
  import tkinter as tk
  
  at = False
  dotcom = False
  list = [['ID', 'NAME', 'EMAIL', 'BIRTHDATE']]
  ID = 1
  storedIndex = 0
  
  
  def callback(event):
  
  
      custid.config(state=NORMAL)
      custid.delete('1.0', END)
      custid.insert(1.0, list[event.widget._values][0])
      custid.config(state=DISABLED)
  
      cName.set(list[event.widget._values][1])
      cEmail.set(list[event.widget._values][2])
      birthdate.set(list[event.widget._values][3])
  
      indexPosition = event.widget._values
      delete(indexPosition)
  
  def createTable():
      for i in range(len(list)):
          for j in range(len(list[0])):
              mgrid = tk.Entry(window, width = 10, bg= 'yellow')
              mgrid.insert(tk.END, list[i][j])
              mgrid._values= i
              mgrid.grid (row = i + 5,column = j + 5)
              mgrid.bind(&quot;&lt;Button-1&gt;&quot;, callback)
  
  
  def delete(indexPosition):
     list.pop(indexPosition)
     createTable()
  
  
  def save ():
      customerName = False
      Email = False
      birthday = False
      emailCheck = False
      finalCheck = False
  
      monthCheck = False
      dayCheck = False
      yearCheck = False
      minorCheck = False
      slash = False
  
      monthCheck31 = False
      monthCheck30 = False
      monthCheck28 = False
  
      global at
      global dotcom
      global ID
  
  
      if len(custName.get()) != 0:
          labelNameCheck.config(text=&quot;First Name Last Name&quot;)
          customerName = True
      else:
          labelNameCheck.config(text=&quot;!&quot;)
  
      if len(custEmail.get()) != 0:
          labelEmail.config(text=&quot;[a-z]@[a-z].com&quot;)
          Email = True
      else:
          labelEmail.config(text=&quot;!&quot;)
  
      if len(custBday.get()) != 0:
          birthdateCheck.config(text=&quot;mm/dd/yyyy&quot;)
          birthday = True
      else:
          birthdateCheck.config(text=&quot;!&quot;)
  
      for x in range(len(custBday.get())):
  
  
          if x == 9:
              # Slash Checking
              if custBday.get()[2] == &quot;/&quot; and custBday.get()[5] == &quot;/&quot;:
                  slash = True
  
              # Month Checking
              if (int(custBday.get()[0:2]) &lt;= 12):
                  monthCheck = True
  
              # Day of Month Checking
              if (int(custBday.get()[0:2]) == 1):
                  monthCheck31 = True
  
              if (int(custBday.get()[0:2]) == 2):
                  monthCheck28 = True
  
              if (int(custBday.get()[0:2]) == 3):
                  monthCheck31 = True
  
              if (int(custBday.get()[0:2]) == 4):
                  monthCheck30 = True
  
              if (int(custBday.get()[0:2]) == 5):
                  monthCheck31 = True
  
              if (int(custBday.get()[0:2]) == 6):
                  monthCheck30 = True
  
              if (int(custBday.get()[0:2]) == 7):
                  monthCheck31 = True
  
              if (int(custBday.get()[0:2]) == 8):
                  monthCheck31 = True
  
              if (int(custBday.get()[0:2]) == 9):
                  monthCheck30 = True
  
              if (int(custBday.get()[0:2]) == 10):
                  monthCheck31 = True
  
              if (int(custBday.get()[0:2]) == 11):
                  monthCheck30 = True
  
              if (int(custBday.get()[0:2]) == 12):
                  monthCheck31 = True
  
  
              # Day Checking
              if monthCheck31 == True and int(custBday.get()[3:5]) &lt;= 31 and int(custBday.get()[0:2]) != 0:
                  dayCheck = True
  
              elif monthCheck30 == True and int(custBday.get()[3:5]) &lt;= 30 and int(custBday.get()[0:2]) != 0:
                  dayCheck = True
  
              elif monthCheck28 == True and int(custBday.get()[3:5]) &lt;= 28 and int(custBday.get()[0:2]) != 0:
                  dayCheck = True
  
  
  
              # Minor Checking
              if int(custBday.get()[6:8]) == 20 and int(custBday.get()[8:10]) &lt;= 2:
                  minorCheck = True
  
              if int(custBday.get()[6:8]) == 19 and int(custBday.get()[8:10] &lt;= 99):
                  minorCheck = True
  
              # Year Checking
              if minorCheck == True and int(custBday.get()[6:8]) != 0:
                  yearCheck = True
  
              if int(custBday.get()[6:8]) &gt; 20:
                  yearCheck = False
  
      emailInfo = custEmail.get()
  
  
      if '@' in emailInfo:
          at = True
  
      else:
          at = False
  
      if '.com' in emailInfo:
          dotcom = True
      else:
          dotcom = False
  
      if at == True and dotcom == True:
              emailCheck = True
  
      if monthCheck == True and dayCheck == True and yearCheck == True and slash == True:
          finalCheck = True
  
      if customerName == True and Email == True and birthday == True and emailCheck == True and finalCheck == True:
          custid.config(state= NORMAL)
          initialValue = int(custid.get('1.0', END))
          custid.delete('1.0', END)
          list.append([ID, custName.get(), custEmail.get(), custBday.get()])
          custid.insert(1.0, initialValue + 1)
          custid.config(state=DISABLED)
          print(list)
          createTable()
  
          msgbox(&quot;Saved&quot;, &quot;Record&quot;)
  
  
          ID = ID + 1
      else:
          msgbox(&quot;Incorrect Info Provided&quot;, &quot;Record&quot;)
  
  
  
  def keyup(e):
  
     global at
     global dotcom
     for x in range(len(custEmail.get())):
          if custEmail.get()[-1] == &quot;@&quot; and x &gt; 1:
              at = True
          else:
              labelEmail.config(text=&quot;Bad Email&quot;)
  
          if x &gt; 4 and custEmail.get()[-4:] == &quot;.com&quot; and at == True:
              dotcom = True
          else:
              labelEmail.config(text=&quot;Bad Email&quot;)
  
          if at == True and dotcom == True:
              labelEmail.config(text=&quot;Good Email&quot;)
  
          else:
              labelEmail.config(text=&quot;Bad Email&quot;)
  
  def keyupBdate(e):
      for x in range(len(custBday.get())):
          monthCheck = False
          dayCheck = False
          yearCheck = False
          minorCheck = False
          slash = False
  
          monthCheck31 = False
          monthCheck30 = False
          monthCheck28= False
  
          if x == 9:
              #Slash Checking
              if custBday.get()[2] == &quot;/&quot; and custBday.get()[5] == &quot;/&quot;:
                  slash = True
                  print(&quot;Slash Check = Pass&quot;)
              else:
                  print(&quot;Slash Check = Fail&quot;)
  
              #Month Checking
              if (int(custBday.get()[0:2]) &lt;= 12):
                  monthCheck = True
                  print(&quot;MonthCheck = Pass&quot;)
              else :
                  print(&quot;MonthCheck = Failed&quot;)
  
              #Day of Month Checking
              if (int(custBday.get()[0:2]) == 1):
                  monthCheck31 = True
                  print(&quot;Month Days = 31&quot;)
              if (int(custBday.get()[0:2]) == 2):
                  monthCheck28 = True
                  print(&quot;Month Days = 28&quot;)
              if (int(custBday.get()[0:2]) == 3):
                  monthCheck31 = True
                  print(&quot;Month Days = 31&quot;)
              if (int(custBday.get()[0:2]) == 4):
                  monthCheck30 = True
                  print(&quot;Month Days = 30&quot;)
              if (int(custBday.get()[0:2]) == 5):
                  monthCheck31 = True
                  print(&quot;Month Days = 31&quot;)
              if (int(custBday.get()[0:2]) == 6):
                  monthCheck30 = True
                  print(&quot;Month Days = 30&quot;)
              if (int(custBday.get()[0:2]) == 7):
                  monthCheck31 = True
                  print(&quot;Month Days = 31&quot;)
              if (int(custBday.get()[0:2]) == 8):
                  monthCheck31 = True
                  print(&quot;Month Days = 31&quot;)
              if (int(custBday.get()[0:2]) == 9):
                  monthCheck30 = True
                  print(&quot;Month Days = 30&quot;)
              if (int(custBday.get()[0:2]) == 10):
                  monthCheck31 = True
                  print(&quot;Month Days = 31&quot;)
              if (int(custBday.get()[0:2]) == 11):
                  monthCheck30 = True
  
              if (int(custBday.get()[0:2]) == 12):
                  monthCheck31 = True
                  print (&quot;Month Days = 31&quot;)
  
              #Day Checking
              if monthCheck31 == True and int(custBday.get()[3:5]) &lt;= 31 and int(custBday.get()[0:2]) != 0:
                  dayCheck = True
                  print (&quot;Day Check = Pass&quot;)
              elif monthCheck30 == True and int(custBday.get()[3:5]) &lt;= 30 and int(custBday.get()[0:2]) != 0:
                  dayCheck = True
                  print(&quot;Day Check = Pass&quot;)
              elif monthCheck28 == True and int(custBday.get()[3:5]) &lt;= 28 and int(custBday.get()[0:2]) != 0:
                  dayCheck = True
                  print(&quot;Day Check = Pass&quot;)
              else :
                  birthdateCheck.config(text=&quot;Incorrect Date Format&quot;)
  
              #Minor Checking
              if int(custBday.get()[6:8]) == 20 and int(custBday.get()[8:10]) &lt;= 2:
                  minorCheck = True
                  print(&quot;Minor Check: Passed&quot;)
              else:
                  birthdateCheck.config(text=&quot;Invalid Year&quot;)
  
              if  int(custBday.get()[6:8]) == 19 and int(custBday.get()[8:10] &lt;= 99):
                  minorCheck = True
                  print(&quot;Minor Check: Passed&quot;)
              else:
                  birthdateCheck.config(text=&quot;Invalid Year&quot;)
  
              #Year Checking
              if minorCheck == True and int(custBday.get()[6:8]) != 0:
                  yearCheck = True
                  print (&quot;Year Check: Pass \n&quot;)
              elif minorCheck == False:
                  birthdateCheck.config(text=&quot;You must be 18+ of age to save account&quot;)
                  print(&quot;Customer is a Minor&quot;)
  
              if int(custBday.get()[6:8]) &gt; 20:
                  birthdateCheck.config(text=&quot;Invalid Year&quot;)
  
  
  
  
          else :
              birthdateCheck.config(text = &quot;Wrong Date&quot;)
  
          if slash == True and monthCheck == True and yearCheck == True and dayCheck == True:
              birthdateCheck.config(text = &quot;✓&quot;)
  
  
  
  def msgbox (msg, titlebar):
      messagebox.showinfo(title = titlebar, message=msg)
  
  def products():
      window = Tk()
      window.title(&quot;Products Form&quot;)
      window.geometry(&quot;550x400&quot;)
      window.configure(bg=&quot;orange&quot;)
  
  
  
  window = Tk()
  window.title(&quot;Sample Window&quot;)
  window.geometry(&quot;550x400&quot;)
  window.configure(bg=&quot;orange&quot;)
  
  menubar = Menu(window)
  filemenu = Menu(menubar, tearoff=0)
  menubar.add_cascade(label=&quot;File&quot;, menu=filemenu)
  filemenu.add_command(label=&quot;Products&quot;, command=products)
  filemenu.add_command(label=&quot;Orders&quot;)
  filemenu.add_separator()
  filemenu.add_command(label=&quot;Close&quot;, command = window.quit)
  
  window.config(menu=menubar)
  
  labelTitle = Label(window, text=&quot;Customer Registration System&quot;, width=30, height=1, bg=&quot;yellow&quot;, anchor= &quot;center&quot;)
  labelTitle.config(font=(&quot;Courier&quot;, 10))
  labelTitle.grid(column=2, row=1)
  
  labelID = Label(window, text=&quot;Customer ID&quot;, width = 20, height = 1, bg = &quot;yellow&quot;)
  labelID.grid(column=1, row=2)
  
  cID = StringVar()
  custid = Text(window, width=15, height=1)
  custid.grid(column=2, row=2)
  custid.insert(1.0, &quot;1&quot;)
  custid.config(state = DISABLED)
  
  labelNameCheck = Label(window, text=&quot;Last Name, First Name&quot;, width = 20, height = 1, bg = &quot;yellow&quot;)
  labelNameCheck.grid(column=3, row=3)
  labelName = Label(window, text=&quot;Customer Name&quot;, width = 20, height = 1, bg = &quot;yellow&quot;)
  labelName.grid(column=1, row=3)
  
  cName = StringVar()
  custName = Entry(window, textvariable = cName)
  custName.grid(column=2, row=3)
  
  labelEmail = Label(window, text=&quot;Customer Email&quot;, width = 20, height = 1, bg = &quot;yellow&quot;)
  labelEmail.grid(column=1, row=4)
  
  
  cEmail = StringVar()
  custEmail = Entry(window, textvariable = cEmail)
  custEmail.grid(column=2, row=4)
  custEmail.bind(&quot;&lt;KeyRelease&gt;&quot;, keyup)
  
  labelEmail = Label(window, text=&quot;[a-z]@[a-z].com&quot;, width = 20, height = 1, bg = &quot;yellow&quot;)
  labelEmail.grid(column=3, row=4)
  
  labelBday = Label(window, text=&quot;Customer Birthdate&quot;, width = 20, height = 1, bg = &quot;yellow&quot;)
  labelBday.grid(column=1, row=5)
  
  birthdate= StringVar()
  custBday = Entry(window, textvariable = birthdate)
  custBday.grid(column=2, row=5)
  custBday.bind(&quot;&lt;KeyRelease&gt;&quot;, keyupBdate)
  
  
  birthdateCheck = Label(window, text=&quot;mm/dd/yyyy&quot;, width = 20, height = 1, bg = &quot;yellow&quot;)
  birthdateCheck.grid(column=3, row=5)
  
  savebtn = Button(text = &quot;Save&quot;, command = save)
  savebtn.grid(column=1)
  
  
  deletebtn = Button(text = &quot;Delete&quot;, command = delete)
  deletebtn.grid(column=1)
  
  
  
  window.mainloop()
  </code></pre>