-4
people I am making a school system with python using the modules Tkinter and Sqlite but when I insert the variables of the text boxes in the database information it gives this problem
take a look at my script
from tkinter import *
import sqlite3
import sys
def bt1_click():
print('Nome do aluno: ',ed1.get())
print('Nome do responsavel: ',ed2.get())
print('Numero de contato: ',ed3.get())
print('Ano de escolariade: ',ed4.get())
print('data de naiscimento: ',ed5.get())
print('O aluno apresenta alguma deficiencia ?: ',texto.get("1.0",END))
root = Tk()
lb1= Label(text='nome do aluno: ')
lb2= Label(text='Nome do responsavel: ')
lb3= Label(text='Numero de contato: ')
lb4= Label(text='Ano de escolariade: ')
lb5= Label(text='data de naiscimento: ')
lb6= Label(text='Idade do aluno: ')
lb7= Label(text='O aluno apresenta alguma deficiencia ?: ')
lb8= Label(text='')
lb1.grid(row=1, column=0)
lb2.grid(row=3, column=0)
lb3.grid(row=5, column=0)
lb4.grid(row=7, column=0)
lb5.grid(row=10, column=0)
lb6.grid(row=9, column=0)
lb7.grid(row=11, column=0)
lb8.grid(row=13,column=0)
ed1= Entry('')
ed2= Entry('')
ed3= Entry('')
ed4= Entry('')
ed5= Entry('')
ed6= Entry('')
texto = Text('', height = 13, width = 20)
ed1.grid(row=2,column=0)
ed2.grid(row=4,column=0)
ed3.grid(row=6,column=0)
ed4.grid(row=8,column=0)
ed5.grid(row=10,column=0)
texto.grid(row=12,column=0)
bt1 = Button(text='enviar ao banco de dados', command=bt1_click)
bt1.grid(row=14,column=0)
root.geometry('220x500+100+100')
root.title('Ssystem')
root.mainloop()
ee1 = ed1.get()
ee2 = ed2.get()
ee3 = ed3.get()
ee4 = ed4.get()
ee5 = ed5.get()
ee6 = ed6.get()
banco = sqlite3.connect('SchoolSystem_Users.db')#objeto de conexao com o banco
cursor = banco.cursor()
#cursor.execute("CREATE TABLE users (Nome do aluno, Nome do responsavel, numero do responsavel,ano de escolaridade,data de naiscimento,idade do aluno)")
cursor.execute("INSERT INTO users VALUES ('ee1''ee2''ee3''ee4''ee5''ee5')")
banco.commit()
""" cursor.execute('''SELECT * FROM users ''')
print(cursor.fetchall()) """
----------
==========
Would you like to check the indentation of the code you pasted? It is wrong, and then we cannot know what is part of a function and what is not. Also, if you have more than one archive, put it in separate blocks - you have strange symbols there that would be syntax error in Python (row of
-----
and of====
) - And finally, your database code on that list will never run, since it’s after the "mainloop" call. Put down a list that works, and give the error you want to clarify.– jsbueno