Student Registration System

Student Registration System


  • Output->





  • Program->

from tkinter import *
from tkinter import messagebox
import sqlite3 as sq

#=================Container=========================================
root=Tk()
root.title("Student Tracker")
root.geometry('800x600')
header=Label(root, text="Livewire Registration", font=("arial",30,"bold"), fg="steelblue").pack()
header=Label(root, text="By Aryadrj", font=("arial",30,"bold"), fg="red").pack()
conn=sq.connect('Student.db')
cur=conn.cursor()
#==================Labels======================
L1=Label(root,text="Usn",font=("arial",18)).place(x=10,y=150)
L2=Label(root,text="Name",font=("arial",18)).place(x=10,y=200)
L4=Label(root,text="Sem",font=("arial",18)).place(x=10,y=250)
L5=Label(root,text="Dob",font=("arial",18)).place(x=10,y=300)
#=================DropDown====================
dd1=StringVar(root)#Dropdown list1
dd2=StringVar(root)#Dropdown list2

dd1.set('Click here To choose college')
dd2.set('Click here To choose college')

ddlist={'Sait','Msrit','Vit','Jnc'}

dd3=OptionMenu(root,dd1,*ddlist)
dd4=OptionMenu(root,dd2,*ddlist)
dd3.place(x=10,y=105)
dd4.place(x=10,y=400)
#==================Input=======================
Usn=StringVar(root)
Name=StringVar(root)
Sem=StringVar(root)
Dob=StringVar(root)

Usn1=Entry(root,textvariable=Usn)
Name1=Entry(root,textvariable=Name)
Sem1=Entry(root,textvariable=Sem)
Dob1=Entry(root,textvariable=Dob)

Usn1.place(x=100,y=155)
Name1.place(x=100,y=205)
Sem1.place(x=100,y=255)
Dob1.place(x=100,y=305)

#==================Function=======================
def get():
    print("You have Submitted a record")
    cur.execute('CREATE TABLE ' +dd1.get()+'(Usn INTEGER,Name TEXT,Sem TEXT,Dob TEXT)')
  
    cur.execute('insert into ' +dd1.get() +'(Usn,Name,Sem,Dob)values(?,?,?,?)',(Usn.get(),Name.get(),Sem.get(),Dob.get()))
    print("Insertion done")
    conn.commit()

def clear():
    dd1.set('Click here To choose college')
    dd2.set('Click here To choose college')
    Usn.set('')
    Name.set('')
    Sem.set('')
    Dob.set('')

def open1():
    cur.execute('SELECT * FROM ' +dd1.get())
    frame=Frame(root)
    Lb=Listbox()
    Lb.pack()
    data = cur.fetchall()
    for row in data:
        Lb.insert(1,row)
    conn.commit()

def drop():
    cur.execute('Drop table if exists '+dd1.get())
    print("Your database is deleted")
  
#===================Button======================
Button1=Button(root,text="Submit",fg='red',command=get)
Button2=Button(root,text="Clear",fg='brown',command=clear)
Button3=Button(root,text="Open Database",fg='Blue',command=open1)
Button4=Button(root,text="Delete",fg='Black',command=drop)
Button1.place(x=250,y=400)
Button2.place(x=320,y=400)
Button3.place(x=380,y=400)
Button4.place(x=480,y=400)
#==============================================
root.mainloop()

=========================

Comments

Popular posts from this blog

How to set image in carousel using flask?

Invalid syntax , perhaps you forgot a comma? Error in Python

How to run PL/SQL Code With Command Line?