In this project, we are going to create a Student Record System using python’s Tkinter module. Tkinter is the standard GUI library for Python.
1) Import module Tkinter and sqlite3
from tkinter import *
2) Create the main window
a) A window is an instance of Tkinter’s Tk class.
b) Set the dimension and title.
3) Establish a connection to the database by creating a connection object then create a Cursor object using the cursor method of the connection object
con = sqlite3.connect("student_record.db") c = con.cursor()
4) Create a table
c.execute("CREATE TABLE student(roll_no integer,first_name text,last_name text,address text,phone integer)")
5) Create Entry boxes and labels for first name, last name, etc
6) Create four buttons submit, display, delete and edit.
7) Create an Entry box to get the record id that has to be edited or deleted.
8) Write five functions to perform the operations.
a)submit function-Connect to the database and execute insert statement.
b)save function-Connect to the database and get the record id that you want to update and execute the update statement.
c)edit function-Create a new window, connect to the database, and get all the details of the required id using a select statement. Create labels and Entry boxes and insert the records into the Entry boxes. Create a save button and assign the save function to the command.
d)delete function-Connect to the database and execute Delete statement.
e)display function-Connect to the database and execute select statement, get all the records. create a label to display the records.
Submitted by Sumedha Kulkarni (Sumedha)
Download packets of source code on Coders Packet