I'm trying to add information to a sqlite3 database from an entry. I also want a dropdown menu to have the data from the database. When I'm doing that, I get a AttributeError: 'NoneType' object has no attribute 'get' error. Could someone help successfully accomplish this?
Code:
from tkinter import *
import os
import sqlite3
window=Tk()
window.title("Scheduling Assistant")
window.geometry("400x300")
addname1=Label(text="Add Last Name:").pack()
addname = Entry(window).pack()
addquality1=Label(text="Add Quality (A,B, Or C):").pack()
addquality = Entry().pack()
def click():
lstnme=addname.get()
quality=addquality.get()
c.execute("INSERT INTO densist VALUES ('lstnme','quality')")
submit=Button(text='Submit',command=click).pack()
conn=sqlite3.connect("dentist0.db")
c=conn.cursor()
c.execute("""CREATE TABLE IF NOT EXISTS densist(
last_name text,
class text)""")
clicked=StringVar()
c.execute("SELECT last_name FROM densist")
drpdwn=OptionMenu(window,clicked, c.fetchall())
drpdwn.pack()
conn.commit()