I'm doing a people registration program with interface (still pretty basic, just to do tests) and I'm having several difficulties:
- I am extracting the data using
.get()
, however, I can only type 1 character. If I type more then the following error appears: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied .
Code:
from tkinter import *
import sqlite3
import time
import datetime
connection = sqlite3.connect('Main_9_DB.db')
c = connection.cursor()
def create_table():
c.execute('CREATE TABLE IF NOT EXISTS teste (ed text)')
create_table()
def dataentry():
c.execute('INSERT INTO teste (ed)VALUES (?)',(ed.get()))
connection.commit()
def bt_onclick():
# print(ed.get())
dataentry()
janela = Tk()
var = StringVar()
ed = Entry(janela, bd = 2, textvariable = var)
ed.place(x = 50, y = 100)
bt = Button(janela, width=20, text="OK", command=bt_onclick)
bt.place(x = 50, y = 150)
lb = Label(janela, text="Label")
lb.place(x = 100, y = 200)
janela.geometry("300x300+300+300")
janela.mainloop()
If you can answer me, I'm grateful.