title: Python/MySQL - Insert data into table by Tkinter
body: <p>I am trying to insert data into the table through the graphical interface, but the following error appears:</p>
  
  <p>Error</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "C:\Users\TESTES\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 1883, in __call__
      return self.func(*args)
  TypeError: submit() missing 3 required positional arguments: 'nome', 'idade', and 'cpf'
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>from tkinter import *
  import pymysql
  
  
  book = Tk()
  book.geometry("400x300")
  book.title("test")
  
  ##-----------------##
  ##  CONEXÃO BANCO  ##
  ##-----------------##
  
  conn = pymysql.connect(host="localhost", port=3306, user="root", password="", database="oneday")
  print("connect successfull! goodwork bro screw screww")
  cursor = conn.cursor()
  cursor.execute("SELECT VERSION()")
  versao = cursor.fetchone()
  print("Versão do gerenciador Maria DB: %s" % versao)
  conn.close()
  
  ##-----------------##
  ##    STRINGVAR    ##
  ##-----------------##
  
  
  ##-----------------##
  ##  FUNÇÕES/DEF'S  ##
  ##-----------------##
  
  def submit(nome, idade, cpf):
  
  
      nome = StringVar()
      idade = StringVar()
      cpf = StringVar()
  
      try:
          conn = pymysql.connect(host="localhost", port=3306, user="root", password="", db="oneday")
          cursor = conn.cursor()
          mysql_submit = ("INSERT INTO novo VALUES (NULL, {}, {}, {})", (nome.get(), idade.get(), cpf.get()))
          cursor.execute(mysql_submit)
          conn.commit()
          print("Dados inseridos com sucesso na tabela.")
          cursor.close()
          conn.close()
      except pymysql.connector.Error as error:
          print("failed".format(error))
      finally:
          if (conn.connect()):
              cursor.close()
              conn.close()
              print("MySQL connection is closed")
  
          # Clear the text boxes
          e_nome.delete(0, END)
          e_idade.delete(0, END)
          e_cpf.delete(0, END)
  
  
  def closer():
      try:
          conn = pymysql.connect(host="localhost", port=3306, user="root", password="", db="oneday")
          cursor = conn.cursor()
          mysql_closer = """DELETE FROM novo"""
          cursor.execute(mysql_closer)
          conn.commit()
          print("Dados removidos com sucesso da tabela.")
          cursor.close()
          conn.close()
      except pymysql.connector.Error as error:
          print("failed".format(error))
      finally:
          if (conn.connect()):
              cursor.close()
              conn.close()
              print("MySQL connection is closed")
  
  
  ##-----------------##
  ##     LABELS      ##
  ##-----------------##
  
  mylabel = LabelFrame(book, text="Novo")
  mylabel.place(x=10, y=10, width=300, height=150)
  
  l_nome = Label(book, text="Nome")
  l_nome.place(x=15, y=30)
  e_nome = Entry(book)
  e_nome.place(x=100, y=30)
  
  l_idade = Label(book, text="Idade")
  l_idade.place(x=15, y=60)
  e_idade = Entry(book)
  e_idade.place(x=100, y=60)
  
  l_cpf = Label(book, text="CPF")
  l_cpf.place(x=15, y=90)
  e_cpf = Entry(book)
  e_cpf.place(x=100, y=90)
  
  ##-----------------##
  ##     BOTOÕES     ##
  ##-----------------##
  
  bt = Button(book, width=15, text="Gravar", command=submit)
  bt.place(x=100, y=175)
  
  bt = Button(book, width=15, text="Sair", command=exit)
  bt.place(x=100, y=245)
  
  bt = Button(book, width=15, text="Apagar", command=closer)
  bt.place(x=100, y=210)
  
  
  ##-----------------##
  ##     IMAGEM      ##
  ##-----------------##
  
  photo = PhotoImage(file="C:/Users/TESTES/PycharmProjects/OMNIA/images/logo.png")
  logo = Label(book, image=photo)
  logo.place(x=250, y=175, width=100, height=100)
  logo.background = "orange"
  
  
  book.mainloop()
  </code></pre>