Skip to content

STUDENT NOTE SYSTEM

import sqlite3
import sys
from tkinter import *
import time
import messagebox

window1 = Tk()
window1.geometry("450x200")
window1.configure(background="coral")
window1.title("LOGIN")

var1= StringVar()
var2= StringVar()

def reset():
    var1.set("")
    var2.set("")

def login():
    if var1.get()=="123456789":
        if var2.get()=="987654321":
            window1.destroy()
            window2 = Tk()
            window2.geometry("500x600")
            window2.configure(background="coral")
            var3 = StringVar()
            var4 = StringVar()
            var5 = StringVar()
            var6 = StringVar()

            def loginsystem():
                con = sqlite3.connect("notes.db")
                cursor = con.cursor()

                def createTable():
                    cursor.execute(
                        "CREATE TABLE IF NOT EXISTS students(name TEXT,surname TEXT,number INT,students note INT)")

                def addStudents(name, surname, number, note):
                    cursor.execute(
                        "INSERT INTO students VALUES('{} ','{}','{}','{}')".format(name, surname, number, note))
                    con.commit()
                    con.close()

                createTable()
                name = var3.get()
                surname = var4.get()
                number = var5.get()
                note = var6.get()
                addStudents(name, surname, number, note)

            def quitsystem():
                qExit = messagebox.askyesno("QUİT", "Do you want to quit?")
                if qExit > 0:
                    sys.exit()

            def reset():
                var3.set("")
                var4.set("")
                var5.set("")
                var6.set("")



            titleFrame1 = Frame(window2, bg="coral4", width=350, height=80, relief="raise", bd=7)
            titleFrame1.place(relx=0.15, rely=0.03)
            title1 = Label(window2, text="STUDENT NOTE SYSYEM", bg="coral4", fg="black",
                           font=("Times New Roman", 19, "bold"))
            title1.place(relx=0.2, rely=0.06)

            max = Label(window2, text="""
,¤°´'`°·.¸O¸.·°´'`°¤,
(*SCHOOL*)
(_¸.·*´'`°¤¸'¸¤°´'`*·.¸_)
---ENG---""", font=("Times New Roman", 17, "bold"), bg="coral")
            max.place(relx=0.28, rely=0.18)

            name = Label(window2, text="NAME", font=("Times New Roman", 16, "bold"), bg="coral", fg="black")
            name.place(relx=0.23, rely=0.45)
            entryname = Entry(window2, width=25, bg="coral3",
                              font=("Times New Roman", 15, "bold"),textvariable=var3)
            entryname.place(relx=0.41, rely=0.45)

            surname = Label(window2, text="SURNAME",
                            font=("Times New Roman", 16, "bold"), bg="coral", fg="black")
            surname.place(relx=0.15, rely=0.525)
            entrysurname = Entry(window2, width=25, bg="coral3",
                                 font=("Times New Roman", 15, "bold"),textvariable=var4)
            entrysurname.place(relx=0.41, rely=0.525)

            number = Label(window2, text="NUMBER", font=("Times New Roman", 16, "bold"),
                           bg="coral", fg="black")
            number.place(relx=0.17, rely=0.6)
            entrynumber = Entry(window2, width=25, bg="coral3",
                                font=("Times New Roman", 15, "bold"),textvariable=var5)
            entrynumber.place(relx=0.41, rely=0.6)

            note = Label(window2, text="NOTE", font=("Times New Roman", 16, "bold"),
                         bg="coral", fg="black")
            note.place(relx=0.24, rely=0.675)
            entrynote = Entry(window2, width=25, bg="coral3",
                              font=("Times New Roman", 15, "bold"),textvariable=var6)
            entrynote.place(relx=0.41, rely=0.675)

            loginstudent = Button(window2, text="SAVE",
                                  font=("Times New Roman", 15, "bold"),
                                  bg="coral3",
                                  relief="raise", bd=4,command=loginsystem)
            loginstudent.place(relx=0.65, rely=0.8)

            reset = Button(window2, text="RESET", font=("Times New Roman", 15, "bold"),
                           bg="coral3",command=reset,
                           relief="raise", bd=4)
            reset.place(relx=0.45, rely=0.8)

            quit = Button(window2, text="QUIT ", font=("Times New Roman", 15, "bold"),
                          bg="coral3",command=quitsystem,
                          relief="raise", bd=4)
            quit.place(relx=0.26, rely=0.8)

            window2.mainloop()

        else:
            messagebox.showinfo("WARNING","""
            WRONG INTRODUCTION""")
            var1.set("")
            var2.set("")
    else:
        messagebox.showinfo("WARNING", """
        WRONG INTRODUCTION""")
        var1.set("")
        var2.set("")

# butons
loginbutton = Button(text="LOGIN",command=login,bg="coral3",
                     font=("Times New Roman",14, "bold"))
loginbutton.place(relx=0.5,rely=0.7)

resetbuton = Button(text="RESET",bg="coral3",font=("Times New Roman",14, "bold"),command=reset)
resetbuton.place(relx=0.25,rely=0.7)

# Label
frame1 = Frame(window1,bg="coral3",width=300,height=40,relief="raise",bd=5)
frame1.place(relx=0.175,rely=0.05)

text1 = Label(window1,bg="coral3",text="  STUDENT NOTE SYSTEM",font=("Times New Roman",16, "bold"))
text1.place(relx=0.2,rely=0.07)

text2 = Label(window1,bg="coral",text="USERNAME",font=("Times New Roman",14, "bold"))
text2.place(relx=0.05,rely=0.35)
entry1 = Entry(window1,bg="coral4",width=25,font=("Times New Roman",14, "bold"),textvariable=var1)
entry1.place(relx=0.37,rely=0.35)

text3 = Label(window1,bg="coral",text="PASSWORD",font=("Times New Roman",14, "bold"))
text3.place(relx=0.05,rely=0.5)
entry1 = Entry(window1,bg="coral4",width=25,font=("Times New Roman",14, "bold"),show="*",textvariable=var2)
entry1.place(relx=0.37,rely=0.5)


window1.mainloop()

8 Comments »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: