Как из entry в tkinter забрать, и записать переменную в sqlite3
Есть такой код, как сделать так чтобы при нажатии кнопки "Обновить список". Данные из полей записывались в бд?
import tkinter
from tkinter import *
import tkinter.messagebox as mb
from ttkwidgets.autocomplete import AutocompleteCombobox
import sqlite3
# Списки для выбора
lst = ["Backend devoloper", "DevOps devoloper", "Frontend devoloper"]
lst2 = ["Свободен", "Частично свободен", "Занят"]
lst3 = ["Medium", "Maximum", "Full"]
#Подключение и иницилизация DB
conn = sqlite3.connect('personal.db')
cur = conn.cursor()
def delete():
"""function delete user on datebases"""
msg = "Пользователь удалён!"
mb.showinfo("Информация", msg)
def update():
"""function update user on datebases"""
msg = "Список обновлён!"
mb.showinfo("Внимание!", msg)
print(surname, name, fathername, webname, jtitle, status, accesslvl)
cur.execute("INSERT INTO Personals VALUES(?, ?, ?, ?, ?, ?, ?)", (surname, name, fathername, webname, jtitle, status, accesslvl))
def update_profile():
"""function update_profile user on datebases"""
msg = "Запись обновлена!"
mb.showinfo("Информация", msg)
# Инцилизация окна
root = Tk()
root.title("PyBase")
root.geometry("600x800")
# Buttons
b1 = Button(text="Обновить список",
width=15, height=3, command=update)
b1.place(x=20, y=20)
b2 = Button(text="Удалить пользователя",
width=15, height=3, command=delete)
b2.place(x=20, y=80)
b3 = Button(text="Сохранить изменения",
width=15, height=3, command=update_profile)
b3.place(x=20, y=140)
# Enterys
surname = tkinter.Entry(root, width=20)
surname.place(x=320, y=20)
name = tkinter.Entry(root, width=20)
name.place(x=320, y=60)
fathername = tkinter.Entry(root, width=20)
fathername.place(x=320, y=100)
webname = tkinter.Entry(root, width=20)
webname.place(x=320, y=140)
# Labels
label1 = Label(text="Фамилия:")
label1.place(x=220, y=20)
label2 = Label(text="Имя:")
label2.place(x=220, y=60)
label3 = Label(text="Отчество:")
label3.place(x=220, y=100)
label4 = Label(text="Сетевое имя:")
label4.place(x=220, y=140)
label4 = Label(text="Должность:")
label4.place(x=220, y=180)
label4 = Label(text="Статус:")
label4.place(x=220, y=220)
label4 = Label(text="Урвн.доступа:")
label4.place(x=220, y=260)
# Comboboxs
jtitle = AutocompleteCombobox(root, width=19, completevalues=lst)
jtitle.place(x=320, y=180)
status = AutocompleteCombobox(root, width=19, completevalues=lst2)
status.place(x=320, y=220)
accesslvl = AutocompleteCombobox(root, width=19, completevalues=lst3)
accesslvl.place(x=320, y=260)
root.mainloop()