conn = sqlite3.connect('School.db')
c = conn.cursor()
def account_Table(): #Creates the table for user accounts.
c.execute('CREATE TABLE IF NOT EXISTS accounts(datestamp TEXT, u_id INT, username TEXT, password TEXT, classy TEXT, subject TEXT, forename TEXT, surname TEXT)')
def LoginFrame(Frame): #Builds the login/home screen for the program
username_holder = Label(text="Username", bg="#b4c4a1", fg="#000000")
password_holder = Label(text="Password", bg="#b4c4a1", fg="#000000")
username = Entry()
password = Entry(show="*")
username_holder.grid(row=0, column=20)
password_holder.grid(row=1, column=20)
username.grid(row=0, column=40)
password.grid(row=1, column=40)
checkbox = Checkbutton(text="Keep me logged in", bg="#b4c4a1")
checkbox.grid(row=3,column=40)
logbtn = Button(text="Login", bg="#b4c4a1", command = Login_Check)
logbtn.grid(row=3,column=30)
sigup = Button(text="New User", bg="#b4c4a1", command = DataEntry)
sigup.grid(row=3,column=20)
def DataEntry():
datestamp = datetime.datetime.now() #Shows when the account was made
u_id = (random.randrange(0,100)) #Gives the user a unique identifier, I don't really need it as the username is a pretty good identifier for this job.
label_1 = Label(text='Enter A Username', bg="#b4c4a1")
username = Entry()
username.grid(row=4, column=40)
label_1.grid(row=4, column=39)
label_2 = Label(text='Enter A Password', bg="#b4c4a1")
password = Entry(show='*')
label_2.grid(row=5, column=39)
password.grid(row=5, column=40)
label_3 = Label(text='Enter Your Class', bg="#b4c4a1")
classy = Entry()
classy.grid(row=6, column=40)
label_3.grid(row=6, column=39)
subject = Entry()
label_4=Label(text='Enter Your Subject', bg="#b4c4a1")
subject.grid(row=7, column=40)
label_4.grid(row=7, column=39)
label_5=Label(text='Enter Your First Name', bg="#b4c4a1")
forename = Entry()
forename.grid(row=8, column=40)
label_5.grid(row=8, column=39)
surname = Entry()
label_6 = Label(text='Enter Your Second Name', bg="#b4c4a1")
surname.grid(row=9, column=40)
label_6.grid(row=9, column=39)
All of the entries in 'DataEntry():' will go into the account table as a new record.
def Login_Check():
print(".... Doing This Later")
#account_Table()
root = Tk()
root.geometry('630x350')
root.config(bg="#b4c4a1")
root.title("Student Manager")
root.wm_iconbitmap('Icon.png')
LoginFrame(root)
Tk.mainloop
I don't know how to pass the entries from the Tkinter Login Box, as values to an SQL 'INSERT INTO' statement using sqlite3, It did work before using just the console as a method of inputting values, but that defeats the point of having a GUI for the user to use.