2
Good night! Guys, I’m starting in the world of programming and today I was following a tutorial that for me didn’t work and I don’t know how to solve the problem, I tried everything. This is to define a function of a button that sends the data from a login screen to the database. Below:
def Armazenar():
nome = NomeEntry.get()
email = EmailEntry.get()
usuario = UserEntry.get()
senha = PassEntry.get()
Db_Login.cursor.execute("insert into usuarios(Nome, E_mail, Login, Senha)
values(?, ?, ?, ?)", (nome, email, usuario, senha))
Db_Login.conexão.commit()
Creating Record Button
RegistrarButton = ttk.Button(RightFrame, text="Registrar", width=35, command=Armazenar)
When I click on the function button, it shows the following errors:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\celio\AppData\Local\Programs\Python\Python37\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:/Users/celio/PycharmProjects/TKINTER/INDEX.py", line 66, in Armazenar
values(?, ?, ?, ?)""", (nome, email, usuario, senha))
File "C:\Users\celio\PycharmProjects\cursopython\venv\lib\site-packages\pymysql\cursors.py", line 168, in execute
query = self.mogrify(query, args)
File "C:\Users\celio\PycharmProjects\cursopython\venv\lib\site-packages\pymysql\cursors.py", line 147, in mogrify
query = query % self._escape_args(args, conn)
TypeError: not all arguments converted during string formatting
Thanks Jsbueno! Solved.
– Célio Ferreira