Professional Documents
Culture Documents
AN
INDUSTRIAL TRAINING REPORT
ON
STUDENT INFORMATION SYSTEM
AT
CETPA INFOTECH PRIVATE LIMITED
ROORKEE
TRAINING CERTIFICATE
Akshit Jain
COMPANY PROFILE
Our motto is to deliver the best services to you and that is why we
have taken the customized approach because we do not want you
to compromise with your education.
INDEX
1. Python
3. Tkinter
3.1 Introduction
3.2 What is Tkinter ?
3.3 Why Tkinter ?
4. Tkinter Widgets
4.1 Introduction
4.2 Types of widgets
4.3 Event-Driven Processing
4.4 Geometry Managers
5. Project
5.1 Introduction
5.2 Useof SQLite databaseinsystem.
5.3 Source Codes and Screens
6. Conclusion
7. References
1. Python
Introduction:
Setting up a GUI application is similar to how an artist produces a
painting. Conventionally, there is a single canvas onto which the
artist must put all the work. Here’s how it works: you start with a
clean slate, a “top-level” windowing object on which you build
the rest of your components.
Introduction:
The Tkinter module (“Tk interface”) is the standard Python
interfaceto the Tk GUI toolkit from Scriptics(formerly developed
by Sun Labs). Both Tk and Tkinter are available on most Unix
platforms, as well as on Windows and Macintosh systems.
Starting with the 8.0 release, Tk offers native look and feel on all
platforms.
With all the competing GUI toolkits available for the Python
language, what makes Tkinter stand out of the rest? Why is it the
most popular toolkit for use interface design?
To find the answer, one must look at the advantages that it offers:
1. Layered design: The layered approach used in designing
Tkinter gives Tkinter all of the advantages of the TK library.
Therefore, at the time of creation, Tkinter inherited from the
benefits of a GUI toolkit that had been given time to mature.
This makes early versions of Tkinter a lot more stable and
reliable than if it had been rewritten from scratch. Moreover,
the conversion from Tcl/Tk to Tkinter is really trivial, so that
Tk programmers can learn to use Tkinter very easily
.
2. Accessibility: LearningTkinter is very intuitive, and therefore
quick and painless. The Tkinter implementation hides the
detailed and complicated calls in simple, intuitive methods.
This is a continuation of the Python way of thinking, since the
language excels at quickly building prototypes. It is therefore
expected that its preferred GUI library be implemented using
the same approach.
Introduction:
A software widget is a relatively simple and easy-to-use software
application or component made for one or more different software
platforms.
A widget is therefore a graphical object that is available from the
Tkinter library. It is a kind of graphical building block.
Intuitively, widgets are implemented as classes in Tkinter. Each
widget therefore has a constructor, a destructor, its own set of
properties and methods, and so on. While most other GUI toolkits
have a very complex widget hierarchy, Tkinter’s hierarchy is
extremely simple.
Types Of widgets:
1. Toplevel:
The Toplevel is technically not a widget, although this is
more or less transparent to the user.
2. Button:
The Button widget is a rectangular widget that is able to
display text. This text can occupy several lines (if the text
itself contains newlines or if wrapping occurs). Moreover,
this text can have an underlined character (usually indicating
a keyboard shortcut). Buttons are usually used to execute an
action when they are clicked, so they offer the command
option which associates a callback with the event
corresponding to a mouse click with the left mouse button
on the widget.
3. Checkbutton :
The Checkbutton displays some text (or image) along with a
small square called indicator. The indicator is drawn
differently depending on the state of the checkbutton
(selected or not).
4. Entry:
The Entry widget allows users to type and edit a single line
of text. A portion of this text can be selected.
5. Frame:
The Frame widget is a rectangular container for other
widgets. It is primarily used as a gemometry master since it
allows to group widgets. It can have an unvisible border
which is useful to space widgets. It can also have a visible
border with a 3D effect, or no border at all. The Frame
widget does not provide any methods except the standard
Widget methods.
6. Label:
The Label widget is used to display text. It can only display
text in a single font at a time. The text can span more than
one line. In addition, one character in the text can be
underlined, usually indicating a keyboard shortcut. The
Label widget does not provide any methods except the
standard Widget methods.
7. Listbox:
The Listbox widget displays a list of strings. Each string is
displayed on a separate line. It allows to insert, modify or
delete strings from the list. The listbox can only contain text
items, and all items must have the same font and colour.
Depending on the widget configuration, the user can choose
one or more alternatives from the list.
8. Menu:
The Menu widget is used to implement toplevel, pulldown,
and popup menus.
9. Message:
The Message widget is used to display multiple lines of
text. It is very similar to a plain label, but can adjust its
width to maintain a given aspect ratio. The Label widget
does not provide any methods except the standard Widget
methods.
10. OptionMenu:
OptionMenu inherits from Menubutton. It is used to display
a drop-down list of options. It only defines a constructor of
the form: OptionMenu(master, variable, value, *values)
where master is the master widget of this OptionMenu,
variable is a Tkinter, value and *values are the values
displayed by the OptionMenu. The documentation states that
value will be the default variable, but it is not the case. The
only point in having a separate value argument is to ensure
that at least one value is to be displayed. To set the default
value (or any value at any point of the execution), use
variable.set(value).
11. Radiobutton:
The Radiobutton widget used to implement one-of-many
selections. Radiobuttons can contain text or images, and you
can associate a callback with each button to be excuted
when the button is pressed. Each group of Radiobutton
widgets should be associated with a single variable. Each
button then represents a single value for that variable.
12. Scale:
The Scale widget is used to display a slider which allows
the user to select a value within a specified range.
13. Scrollbar:
The Scrollbar widget is a typical scrollbar, with arrows at
both ends and a slider portion in the middle. Unlike typical
scrollbars, its color can be modified.
14. Text
Event-Driven Processing:
Events can include the actual button press (and release), mouse
movement, hitting the Return or Enter key, etc. The entire system
of events that occurs from the beginning until the end of a GUI
application is what drives it. This is known as event-driven
processing.
• This loop runs forever waiting for GUI events, processing them,
and then going to wait for more events to process.
Geometry Managers:
Tk has three geometry managers that help with positioning your
widgetset:
Introduction:
Toolkit Used:
SQLite:
The first argument for insert() is simply the table name. The
second argument tells the framework what to do in the event
that the ContentValues is empty (i.e., you did not put any
values). If you specify the name of a column, the framework
inserts a row and sets the value of that column to null. If you
specify null, like in this code sample, the framework does not
insert a row when there are no values.
The insert() methods returns the ID for the newly created row,
or it will return -1 if there was an error inserting the data. This
can happen if you have conflict with pre-existing data in the
database.
Update a database:
When you need to modify a subset of your database values, use
the update() method . Updating the table combines the
ContentValues syntax of insert() with the WHERE syntax of
delete().
def updateRecord():
if n.get()=='' or f.get()=='' or d.get()=='' or c.get()=='' or e.get()=='' or a.get()=='':
messagebox.showwarning("Warning","All fields are mendatory!")
else:
cid=1
for cr in courses:
if crs.get()==cr:
break
cid+=1
dbs.cur.execute("update registration set name='"+ n.get() +"', father='"+ f.get()+"',
dob='" + d.get() + "', \
contact='"+ c.get() +"', email='"+ e.get() +"', address='"+ a.get() +"', courseid='"+
str(cid) +"' where id='"+ str(sid) +"'")
dbs.db.commit()
messagebox.showinfo("Success","Record has been updated!")
updateform.destroy()
def allstudents():
dbs.cur.execute("select registration.id, registration.name, registration.father,
registration.dob, registration.contact, \
registration.email, registration.address, courses.course, courses.duration, courses.fee from
registration inner join courses on \
registration.courseid=courses.id")
return dbs.cur.fetchall()
def viewRegisteration():
regView=Tk()
regView.geometry("970x710+400+200")
regView.title("All Registration")
regView.config(bg='light green')
getStudents=allstudents()
def myfunction(event):
datacanvas.configure(scrollregion=datacanvas.bbox("all"),width=950,height=600)
dataframe=Frame(regView,bd=1, relief=GROOVE,width=300, height=100)
dataframe.place(x=0,y=0)
datacanvas=Canvas(dataframe)
subframe=Frame(datacanvas)
vscrollbar=Scrollbar(dataframe,orient="vertical",command=datacanvas.yview)
hscrollbar=Scrollbar(dataframe,orient="horizontal",command=datacanvas.xview)
r=1
for row in getStudents:
c=0
sid=row[0]
for column in row:
rclabel=Label(subframe,text=column,anchor=W, font='arial 11')
rclabel.grid(row=r,column=c,sticky=W, padx=2,pady=2)
c+=1
btn=Button(subframe,text='View',font='arial 11 bold',command=partial(viewDetail,sid)
)
btn.grid(row=r,column=c,padx=2,pady=2)
r+=1
def registrationForm():
def makeregistration():
regform=Tk()
regform.geometry("366x568+500+100")
regform.title("Registration")
regform.config(bg='light green')
lbl1=Label(regform,text='Name',bg='light green', font='arial 12 bold')
txt1=Entry(regform,bd=2)
lbl1.grid(row=0,column=0,sticky='W', padx=5,pady=5)
txt1.grid(row=0,column=1,sticky='W', padx=5,pady=5)
lbl2=Label(regform,text="Father's Name",bg='light green', font='arial 12 bold')
txt2=Entry(regform,bd=2)
lbl2.grid(row=1,column=0,sticky='W', padx=5,pady=5)
txt2.grid(row=1,column=1,sticky='W', padx=5,pady=5)
crs=StringVar(regform)
crs.set(courses[0])
corslist=OptionMenu(regform, crs, *courses)
lbl7.grid(row=6,column=0,sticky='W', padx=5,pady=5)
corslist.grid(row=6,column=1,sticky='W', padx=5,pady=5)
regform.mainloop()
#registrationForm()
crs=StringVar(couform)
dr=StringVar(couform)
fe=StringVar(couform)
coubtn=Button(couform,text='Add Course',font='arial 12 bold', command=addCourse)
coubtn.grid(row=5,column=1)
couform.mainloop()
data=val[1]+"\t"+val[2]+"\t"+val[3]+"\t"+val[4]+"\t"+val[5]+"\t"+val[6]+"\t"+val[7]+"\t"+va
l[8]+"\t"+ str(val[9])+"\n"
fobj.write(data)
fobj.close()
Code for DBase:
This is the code that deals with the management of the database
for the system. The database used here is sqlite 3.
import sqlite3
db=sqlite3.connect('sis.db')
cur=db.cursor()
cur.execute("create table if not exists admin(id integer primary key autoincrement, name
char(20), email char(50), password char(50))")
cur.execute("create table if not exists registration(id integer primary key autoincrement, name
char(20), father char(20), dob char(20),\
contact char(15), email char(50), address char(100), courseid int, regdate date)")
cur.execute("create table if not exists courses(id integer primary key autoincrement, course
char(50), duration char(20), fee int)")
db.commit()
cur.execute("insert into admin(name, email, password) values('Akshit','adminAkshit','1234')")
db.commit()
https://docs.python.org/2/library/tkinter.html
https://www.geeksforgeeks.org/python-gui-tkinter/
http://msdl.cs.mcgill.ca/presentations/02.02.Tkinter/python-
intro
https://pythonistaplanet.com/tkinter/
https://pythontextbok.readthedocs.io/en/1.0/Introduction_to_
GUI_Programming.html
https://dzone.com/articles/python-gui-examples-tkinter-
tutorial-like-geeks
https://cseducators.stackexchange.com/questions/5358/any-
simple-python-gui-projects-for-beginner-novice-
programming-students