0
I am doing a program of registration of people with interface (still very basic, just to do tests) and I am with several difficulties:
- I’m extracting the data using the
.get()
, however, I can only type 1 character. If I type more 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’d be grateful.
Thank you very much
– Antônio Gally