Training Project Report ON Note Taking Gui Using Python
Training Project Report ON Note Taking Gui Using Python
ON
NOTE TAKING GUI USING PYTHON
Submitted in partial fulfillment of the requirements for the award of the degree of
Bachelor of technology in
Electronics and Communication
Affiliated to:
(Kurukshetra University, Kurukshetra)
i
ii
PREFACE
This report has been written in correspondence to the guidelines of Kurukshetra University,
Kurukshetra which requires the students to undergo 6 weeks industrial training in order to get
them familiar with the existing and upcoming technologies.
For Information Technology in particular, there are a tremendous number of jobs as well as
technologies emerging every day. The course of industrial training helps students to get
corporate ready. Moreover, they also develop their current skill set which includes both technical
and soft skills. All of this contributes to a new learning experiences, environment and helping
students reach up to their true potential.
iii
ACKNOWLEDGEMENT
Everything happens for a reason and since, I got to spend these 6 weeks learning something that I
think, would stay with me for the rest of my life, there must be a strong reason behind of why I
got across to it in the first place.
There are a number of minds that have contributed to this new learning experience.
First of all, I would like to thank the power above that watches upon us all for keeping
me motivated to complete this project.
I’d like to mention my mentor Mr. Kadam who worked hard and taught me with the same
energy and enthusiasm every single day. Next, I am thankful to my parents and all my family
members for constantly believing in me.
I would also like to thank for providing me all the facilities, a good working
environment and all the support I needed.
iv
CANDIDATE’S DECLARATION
I hereby declare that the project work entitled “NOTE TAKING GUI” submitted to Seth Jai
Prakash Mukand Lal Institute of Engineering and Technology, Radaur is a record of an original
work done by me under the guidance of Mr. Kadam, Faculty Member, ICMT and this project work has
not performed the basis for the award of any other degree or diploma/ associateship/fellowship and
similar project if any.
v
CONTENTS
i) Training Letter ii
iii) Preface iv
iv) Acknowledgment v
1 Introduction 1
2 Training Report 14
vi
2.3 Why note taking? 15
2.4 Components 16
2.5 Workflow 17
4.1 Conclusions 56
vii
FIGURES
1.6 Networking 13
2.1 Workflow 17
viii
CHAPTER 1
1. INTRODUCTION
Python is one stunning language it is utilized all over the place! The intensity of python is
something that everyone is bridling in the cutting edge age innovation.
Regardless of whether it is web improvement, Machine Learning, Software Development and
even Artificial Intelligence, Python has got everything.
Python underpins numerous programming ideal models, including object-situated, basic and
utilitarian programming or procedural styles. It includes a dynamic sort framework and
programmed memory administration and has a huge and extensive standard library. Python
mediators are accessible for establishment on many working frameworks, permitting Python
code execution on a wide assortment of frameworks. Python is a multi-worldview programming
language: question situated programming and organized writing computer programs are
completely upheld, and there are various language highlights which bolster practical
programming and perspective arranged programming. Numerous different ideal models are
upheld utilizing augmentations, including configuration by contract and rationale programming.
Python utilizes dynamic composing and a mix of reference tallying and a cycle-recognizing city
worker for memory administration. A vital element of Python is dynamic name goals (late
official), which ties technique and variable names amid program execution. The outline of
Python offers some help for utilitarian programming in the Lisp convention. The language has
delineate, and channel capacities; perceptions for records, word references, and sets; and
generator articulations. Additionally, Python has critical favorable circumstances over the
different programming languages, for instance:
1
Clean linguistic structure (for distribution of squares to utilize disparagements);
Ordinary dispersion has a great deal of valuable modules (counting the module for
creating GUI);
The utilization Python in intuitive mode (extremely valuable for experimentation and tackle
straightforward issues);
Ordinary dispersion is basic and yet very great advancement condition, or, in other words and
what is composed in Python;
NVIDIA- Did you know that the Self Driving Car research done by NVIDIA is primarily
built on Python? The Deep Learning Libraries such as Tensor flow, Caffee are used.
Google- Python is one of the three official languages used by Google, It is a well-known
fact that Google uses Python for Production services.
Few notable mentions, Twitter, Spotify and Pinterest all use Python on the backend. In fact,
Acadview also uses Python on the backend. (Sounds good enough??) This is probably enough to
see the power of Python.
Build software
2
Automate your work.
Build bots
Few example are using the Facebook API and building a script which would post ”Happy
Birthday” with the user’s name on his birthday! Or you can build a virtual assistant which would
talk / greet you. The use of API means that Python can do anything. Literally.
3
1.4 Comparisons with other programming languages
Python is frequently contrasted with other deciphered languages, for example, Java, JavaScript,
Perl, Tcl, or Smalltalk. Correlations with C++, Common Lisp and Scheme can likewise be
illuminating. In this segment I will quickly contrast Python with every one of these languages.
These examinations focus on language issues as it were. By and by, the decision of a
programming language is frequently directed by other true requirements, for example, cost,
accessibility, preparing, and earlier venture, or even enthusiastic connection. Since these
viewpoints are exceedingly factor, it appears an exercise in futility to think of them as much for
this examination.
Java
Python programs are for the most part anticipated that would run slower than Java programs,
however they likewise set aside substantially less opportunity to create. Python programs are
regularly 3-5 times shorter than proportional Java programs. This distinction can be credited to
Python's worked in abnormal state information composes and its dynamic composing. For
instance, a Python software engineer squanders no time announcing the sorts of contentions or
factors, and Python's great polymorphic rundown and lexicon composes, for which rich syntactic
help is incorporated straight with the language, discover an utilization in relatively every Python
program. Due to the run-time composing, Python's run time must work harder than Java's. For
instance, while assessing the articulation a+b, it should initially review the items an and b to
discover their sort, or, in other words at order time. It at that point conjures the suitable
expansion activity, which might be an over-burden client characterized technique. Java, then
again, can play out an effective whole number or gliding point expansion, however requires
variable statements for an and b, and does not permit over-burdening of the + administrator for
cases of client characterized classes.
4
Hence, Python is vastly improved suited as a "stick" language, while Java is better portrayed as a
low-level execution language. Truth be told, the two together make a brilliant mix. Segments can
be produced in Java and joined to shape applications in Python; Python can likewise be utilized
to model segments until the point that their plan can be "solidified" in a Java usage. To help this
kind of advancement, a Python execution written in Java is a work in progress, which permits
calling Python code from Java and the other way around. In this usage, Python source code is
meant Java bytecode (with assistance from a run-time library to help Python's dynamic
semantics).
Javascript
Python's "question based" subset is generally proportional to JavaScript. Like JavaScript (and not
at all like Java), Python bolsters a programming style that utilizations basic capacities and factors
without taking part in class definitions. Be that as it may, for JavaScript, that is everything that
matters. Python, then again, underpins composing substantially bigger projects and better code
reuse through a genuine protest arranged programming style, where classes and legacy assume a
critical job.
Perl
Python and Perl originate from a comparative foundation (Unix scripting, which both have long
outgrown), and game numerous comparative highlights, yet have an alternate logic. Perl stresses
bolster for basic application-arranged errands, e.g. by having worked in normal articulations,
record filtering and report creating highlights. Python underscores bolster for basic programming
systems, for example, information structure outline and question arranged programming, and
urges software engineers to compose discernable (and in this way viable) code by giving an
exquisite however not excessively obscure documentation. As an outcome, Python approaches
5
Perl yet once in a while beats it in its unique application area; anyway Python has an
appropriateness well past Perl's specialty.
Tcl
Like Python, Tcl is usable as an application expansion language, and additionally a remain
solitary programming language. Be that as it may, Tcl, which customarily stores all information
as strings, is frail on information structures, and executes run of the mill code much slower than
Python. Tcl additionally needs includes required for composing vast projects, for example,
measured namespaces. In this manner, while a "regular" vast application utilizing Tcl generally
contains Tcl expansions written in C or C++ that are particular to that application, a proportional
Python application can frequently be composed in "unadulterated Python". Obviously,
unadulterated Python advancement is significantly snappier than composing and investigate a C
or C++ segment. It has been said that Tcl's one saving grace is the Tk toolbox. Python has
embraced an interface to Tk as its standard GUI segment library.
Tcl 8.0 tends to the speed issuse by furnishing a bytecode compiler with restricted information
compose support, and includes namespaces. Be that as it may, it is as yet a considerably more
lumbering programming language.
Smalltalk
Maybe the greatest contrast among Python and Smalltalk is Python's more "standard" linguistic
structure, which surrenders it a leg on software engineer preparing. Like Smalltalk, Python has
dynamic composing and authoritative, and everything in Python is a protest. Be that as it may,
Python recognizes worked in protest composes from client characterized classes, and presently
doesn't permit legacy from implicit kinds. Smalltalk's standard library of gathering information
6
composes is more refined, while Python's library has more offices for managing Internet and
WWW substances, for example, email, HTML and FTP.
Python has an alternate rationality with respect to the improvement condition and circulation of
code. Where Smalltalk generally has a solid "framework picture" which contains both the earth
and the client's program, Python stores both standard modules and client modules in individual
records which can without much of a stretch be reworked or circulated outside the framework.
One result is that there is in excess of one alternative for appending a Graphical User Interface
(GUI) to a Python program, since the GUI isn't incorporated with the framework.
C++
Nearly everything said for Java likewise applies for C++, simply more so: where Python code is
regularly 3-5 times shorter than equal Java code, usually 5-10 times shorter than equal C++
code! Recounted proof recommends that one Python software engineer can complete in two
months what two C++ developers can't finish in a year. Python sparkles as a paste language, used
to consolidate parts written in C++.
These languages are near Python in their dynamic semantics, yet so unique in their way to deal
with language structure that a correlation turns out to be just about a religious contention: is
Lisp's absence of linguistic structure favorable position or a disservice? It ought to be noticed
that Python has reflective capacities like those of Lisp, and Python projects can build and execute
program sections on the fly. Normally, genuine properties are definitive: Common Lisp is
enormous (in each sense), and the Scheme world is divided between numerous inconsistent
renditions, where Python has a solitary, free, conservative usage.
7
1.5 Future of Python
Artificial Intelligence
Python programming language is without a doubt ruling alternate languages when future
innovations like Artificial Intelligence(AI) comes into the play.
There are a lot of python systems, libraries and apparatuses that are particularly created to guide
Artificial Intelligence to decrease human endeavors with expanded precision and effectiveness
for different improvement purposes.
It is just the Artificial Intelligence that has made it conceivable to create discourse
acknowledgment framework, self-ruling autos, deciphering information like pictures, recordings
and so on.
We have appeared underneath a portion of the python libraries and devices utilized in different
Artificial Intelligence branches.
8
Machine Learning-PyML, PyBrain, scikit-learn, MDP Toolkit, GraphLab Create, MIPy
and so forth.
General AI-pyDatalog, AIMA, EasyAI, SimpleAI and so forth.
Neural Networks-PyAnn, pyrenn, ffnet, neurolab and so forth.
Regular Language and Text Processing-Quepy, NLTK, gensim
9
Big Data
The future scope of python programming language can also be predicted by the way it has helped
big data technology to grow. Python has been successfully contributing in analysing the large
amount of data sets across computer clusters through its high performance toolkits and libraries.
10
Let’s have a look at the python libraries and toolkits used for Data analysis and handling other
big data issues.
Pandas
Scikit-Learn
NumPy
SciPy
GraphLab Create
IPython
Bokeh
Agate
PySpark
Dask
11
Figure 1.5 Machine Learning is a hub to learning.
Networking
Systems administration is another field in which python has a more splendid extension later on.
Python programming language is utilized to peruse, compose and arrange switches and switches
and perform other systems administration robotization errands in a practical and secure way.
12
For these reasons, there are numerous libraries and apparatuses that are based on the highest
point of python language. Here we have recorded a portion of these python libraries and
instruments particularly utilized by system engineers for system mechanization.
Ansible
Netmiko
NAPALM(Network Automation and Programmability Abstraction Layer with
Multivendor Support)
Pyeapi
Junos PyEZ
PySNMP
Paramiko SSH
13
CHAPTER 2
2. Training report
I got to study the various libraries and functions from basic to advanced that are used in Python.
Some of them are tkinter, Numpy, Pandas etc. I also could successfully implement all these in
the Python language.
Since, it is completely different from other programming languages. I got the opportunity
to learn and build things from scratch which helped me see and understand the details more
clearly and deeply.
Data Types
Decision Control System
Loops
Functions
Common Modules used in Python
Classes
Threads
Web Interface
API
Exception Handling
File Handling
Regular Expression
Databases
14
GUI
Basics of Django framework
We were also taught how to use the various commands of the most popular Version Control
System (VCS), GitHub to back up our codes.
My main project happened to be “Note Taking GUI” which made use of almost all the above
mentioned sections of Python.
This handy note taking application allows users to manage their tasks and store it to database.
15
2.4 Components
GUI(Frontend)
Backend(databases)
GUI
Tkinter is utilized to build up the GUI of the application.
Tkinter is the standard GUI library for Python. Python when joined with Tkinter gives a quick
and simple approach to make GUI applications. Tkinter gives a ground-breaking object-situated
interface to the Tk GUI toolbox.
Making a GUI application utilizing Tkinter is a simple undertaking. You should simply play out
the accompanying advances −
Backend
The application uses sql databases and mysql libraries to connect the databases.
The backend logic is using simple CRUD operations to maintain the applications.
Create
Read
Update
Delete
16
2.5 Workflow
Module 1
17
try:
db = NoteDB()
Dashboard().initUI(db)
except Exception as e:
messagebox.showinfo("Error", "Unable to establish database connection.")
This module works on initializing and connecting the application to the database. If the
connection fails, it handles the exception by displaying the error "Unable to establish database
connection."
Module 2
18
def init (self):
try:
NoteDB.db=mysql.connect('localhost',username,password,'db')
NoteDB.cursor = NoteDB.db.cursor()
except Exception as e:
raise
def add_note(self,note):
q="insert into note(msg) values('%s')"%(note.get_msg())
try:
NoteDB.cursor.execute(q)
NoteDB.db.commit()
except Exception as e:
print(e)
NoteDB.db.rollback()
raise
def get_one_note(self,idt):
q="select * from note where id=%d"%(idt)
try:
NoteDB.cursor.execute(q)
result=NoteDB.cursor.fetchall()
obj=Note(idt=result[0],msg=result[1],time=result[2])
return obj
except Exception as e:
raise
def get_all_notes(self):
q="select * from note order by time desc;"
try:
NoteDB.cursor.execute(q)
notes=[]
19
results=NoteDB.cursor.fetchall()
for result in results:
obj=Note(idt=result[0],msg=result[1],time=result[2])
notes.append(obj)
return notes
except Exception as e:
raise
def update_note(self,note):
q="update note set msg='%s' where id=%d"%(note.get_msg(),note.get_idt())
try:
NoteDB.cursor.execute(q)
NoteDB.db.commit()
except Exception as e:
NoteDB.db.rollback()
raise
def search_notes(self,query):
q="select * from note where msg like '%{0}%' order by time desc".format(query)
try:
NoteDB.cursor.execute(q)
notes=[]
results=NoteDB.cursor.fetchall()
for result in results:
obj=Note(idt=result[0],msg=result[1],time=result[2])
notes.append(obj)
return notes
except Exception as e:
raise
def delete_note(self,note):
20
q="delete from note where id=%d"%(note.get_idt())
try:
NoteDB.cursor.execute(q)
NoteDB.db.commit()
except Exception as e:
NoteDB.db.rollback()
raise
This module basically focuses on creating classes and defining functions for the application so
that they can be used later on. Various types of function calls and cursors are created for the
application.
21
Module 3
def refresh_notes(self):
notes=self.curr_notes
temp = []
for note in notes:
try:
temp_note=self.db.get_one_note(note.get_idt())
temp.append(temp_note)
except Exception as e:
pass
self.show_notes(temp)
def show_notes(self,notes):
i=0
self.curr_notes=notes
self.listbox.delete(0,self.listbox.size())
for note in notes:
22
self.listbox.insert(i,str(note.get_msg()))
if i%2==0:
self.listbox.itemconfig(i,bg="#d3d3d3")
i+=1
def search_callback(self):
if len(self.var.get())<=0:
messagebox.showinfo("Invalid Action","Please Enter Search Entry")
return
notes=self.db.search_notes(self.var.get())
if len(notes) ==0:
messagebox.showinfo("Info","No match Found")
else:
self.show_notes(notes)
def list_all_callback(self):
try:
notes=self.db.get_all_notes()
self.show_notes(notes)
except Exception as e:
print(e)
messagebox.showinfo("Error","Could Not Fetch Notes")
def edit_callback(self):
try:
EditNote().initUI(self,self.db,self.curr_notes[self.listbox.curselection()[0]])
except Exception as e:
pass
def add_callback(self):
AddNewNote().initUI(self,self.db)
def initUI(self,db):
23
self.db=db
self.root = Tk()
self.root.geometry("630x500")
self.root.title("Note Taking App by Ayush Madan")
self.Font = font.Font(family='Helvetica', size=15, weight='bold')
self.Font_search_text = font.Font(family='Helvetica', size=15)
self.Font_search_btn = font.Font(family='Helvetica', size=10, weight='bold')
self.Font_note = font.Font(family='Helvetica', size=15)
self.add_button=Button(self.root,width=20,bg="purple",fg="white",text="Add New
Note>>",font=self.Font,command=lambda:self.add_callback())
self.add_button.place(x=20,y=20)
self.list_all_btn=Button(self.root,width=20,bg="purple",fg="white",text="List All
Notes",font=self.Font,command=lambda:self.list_all_callback())
self.list_all_btn.place(x=290,y=20)
self.search_label=Label(self.root,text="Search Notes",font=self.Font)
self.search_label.place(x=20,y=90)
self.var=StringVar()
self.search_box=Entry(self.root,width=40,textvariable=self.var,font=self.Font_search_text)
self.search_box.place(x=20,y=130)
self.search_button=Button(self.root,bg="purple",fg="white",text="Search",font=self.Font_search
_btn,width=13,command=lambda:self.search_callback())
self.search_button.place(x=470,y=130)
self.note_label=Label(self.root,text="-- Notes --",font=self.Font)
self.note_label.place(x=205,y=170)
self.listbox =
Listbox(self.root,selectmode=SINGLE,width=630,font=self.Font_note,height=12)
self.scroll = Scrollbar(self.root, orient=VERTICAL, command=self.listbox.yview)
24
self.listbox['yscroll'] = self.scroll.set
self.scroll.pack(side="right", fill="y")
self.scroll.place(x=615,y=200,height=300)
self.list_all_callback()
self.root.mainloop()
This module works creating various buttons and graphical interface for the user to interact and
use different functions that are available.
25
Module 4
class Note:
def init (self,idt=0,msg="",time=""):
self. idt=idt
self. msg=msg
self. time=time
def get_msg(self):
return self. msg
def get_idt(self):
return self. idt
def get_time(self):
return self. time
def set_msg(self,msg):
self. msg=msg
def set_idt(self,idt):
self. idt=idt
def set_time(self,time):
self. time=time
This module is mainly for function calling so that various options can work when the user clicks
on a button.
Module 5
26
from NoteDB import NoteDB
from Note import Note
class AddNewNote:
def init (self):
pass
def add_new_callback(self):
msg=self.text.get("1.0",'end-1c')
if len(msg) <= 0:
messagebox.showinfo("Invalid Action","Please Enter Note..")
return
try:
obj=Note(msg=msg)
self.db.add_note(obj)
self.dash.list_all_callback()
self.dash.root.attributes('-disabled', False)
self.root.destroy()
messagebox.showinfo("Success","Note Saved..")
except Exception as e:
self.dash.root.attributes('-disabled', False)
self.root.destroy()
messagebox.showinfo("Error","Failed To Save Note.Try Again")
def cancel_callback(self):
self.dash.root.attributes('-disabled', False)
self.root.destroy()
27
def initUI(self,dash,db):
self.dash=dash
self.dash.root.attributes('-disabled', True)
self.db=db
self.root = Tk()
self.root.geometry("500x450")
self.root.protocol("WM_DELETE_WINDOW", self.cancel_callback)
self.root.title("Create New Note")
self.Font = font.Font(family='Helvetica', size=15, weight='bold')
self.Font_search_text = font.Font(family='Helvetica', size=15)
self.Font_search_btn = font.Font(family='Helvetica', size=10, weight='bold')
self.Font_note = font.Font(family='Helvetica', size=12)
self.add_label=Label(self.root,text="Add New Note Below",font=self.Font)
self.add_label.place(x=170,y=15)
self.text = Text(self.root,font=self.Font_note,width=55,height=18)
self.text.place(x=0,y=40)
self.scroll = Scrollbar(self.root, orient=VERTICAL, command=self.text.yview)
self.text['yscroll'] = self.scroll.set
self.scroll.pack(side="right", fill="y")
self.scroll.place(x=485,y=40,height=330)
self.save_button=Button(self.root,bg="purple",fg="white",text="Save",command=lambda:self.a
dd_new_callback(),font=self.Font_search_btn,width=13)
self.save_button.place(x=300,y=390)
28
self.cancel_button=Button(self.root,bg="purple",fg="white",text="Cancel",command=lambda:se
lf.cancel_callback(),font=self.Font_search_btn,width=13)
self.cancel_button.place(x=100,y=390)
self.root.mainloop()
This module is for the formatting and customization of the application i.e. the fonts, the font size,
the colours used, the size of the GUI window, the assignment of function calls to the particular
buttons etc.
Module 6
29
self.dash.root.attributes('-disabled', False)
self.root.destroy()
messagebox.showinfo("Success","Note Updated..")
except Exception as e:
self.dash.root.attributes('-disabled', False)
self.root.destroy()
messagebox.showinfo("Error","Failed To Update Note.Try Again")
def cancel_callback(self):
self.dash.root.attributes('-disabled', False)
self.root.destroy()
def delete_callback(self,note):
try:
self.db.delete_note(note)
self.dash.list_all_callback()
self.dash.root.attributes('-disabled', False)
self.root.destroy()
messagebox.showinfo("Success","Note Deleted!")
except Exception as e:
self.dash.root.attributes('-disabled', False)
self.root.destroy()
30
messagebox.showinfo("Error","Failed To Delete Note.Try Again")
def initUI(self,dash,db,note):
self.dash=dash
self.dash.root.attributes('-disabled', True)
self.db=db
self.root = Tk()
self.root.geometry("500x500")
self.root.protocol("WM_DELETE_WINDOW", self.cancel_callback)
self.root.title("Edit Note")
self.Font = font.Font(family='Helvetica', size=15, weight='bold')
self.Font_search_text = font.Font(family='Helvetica', size=15)
self.Font_search_btn = font.Font(family='Helvetica', size=10, weight='bold')
self.Font_note = font.Font(family='Helvetica', size=12)
self.add_label=Label(self.root,text="View\Edit Note",font=self.Font)
self.add_label.place(x=170,y=15)
self.text = Text(self.root,font=self.Font_note,width=55,height=18)
self.text.insert('1.0',note.get_msg())
self.text.place(x=0,y=40)
self.scroll = Scrollbar(self.root, orient=VERTICAL, command=self.text.yview)
self.text['yscroll'] = self.scroll.set
self.scroll.pack(side="right", fill="y")
self.scroll.place(x=485,y=40,height=330)
time="Created At : "+str(note.get_time())
self.time_label=Label(self.root,text=time,font=self.Font_note)
self.time_label.place(x=140,y=385)
31
self.save_button=Button(self.root,bg="purple",fg="white",text="Update",command=lambda:self
.update_callback(note),font=self.Font_search_btn,width=13)
self.save_button.place(x=330,y=430)
self.delete_button=Button(self.root,bg="purple",fg="white",text="Delete",command=lambda:sel
f.delete_callback(note),font=self.Font_search_btn,width=13)
self.delete_button.place(x=180,y=430)
self.cancel_button=Button(self.root,bg="purple",fg="white",text="Cancel",command=lambda:se
lf.cancel_callback(),font=self.Font_search_btn,width=13)
self.cancel_button.place(x=40,y=430)
self.root.mainloop()
This helps in popping up a window which gives the user to either update/edit the note or delete
the note
Note that this option only works when there is already a note present in the database. It doesn’t
work in adding a new note.
------CODE END------
These modules need to be saved in different files but should be present in the same folder to
work
32
2.7 More snapshots from the Note Taking GUI application:
33
34
Implementing all these, I also worked and successfully completed various other projects, which
are:
We were also taught how to use the various commands of the most popular Version Control
System (VCS), GitHub to back up our codes.
35
Restaurant Management System:
c = Tk()
c.geometry("1600x800+0+0")
c.title("Restaurant Management System")
f1 = Frame(c,width = 800,height=700)
f1.pack(side=LEFT)
textin = StringVar()
operator =""
36
txtdisplay = Entry(f2,font=('ariel' ,20,'bold'), textvariable=textin , bd=60 ,insertwidth=7
,bg="orange",justify='right')
txtdisplay.grid(columnspan=4)
def clickbut(n):
global operator
operator += str(n)
textin.set(operator)
def equals():
global operator
val=str(eval(operator))
textin.set(val)
def popupbonus():
popupbonuswindow = tk.Tk()
popupbonuswindow.wm_title("ABOUT")
label1 = Label(popupbonuswindow, text="This is a creation of Ayush Madan", font = ('arial',
50))
label1.grid(row=5, column=2)
def clear():
global operator
operator = ""
textin.set(operator)
def Random1():
x = random.randint(1, 1000)
randomRef = str(x)
37
rand.set(randomRef)
def Ref():
cof =float(Fries.get())
colfries= float(Largefries.get())
cob= float(Burger.get())
cofi= float(Filet.get())
cochee= float(Cheese_burger.get())
codr= float(Drinks.get())
costoffries = cof*25
costoflargefries = colfries*40
costofburger = cob*35
costoffilet = cofi*50
costofcheeseburger = cochee*50
costofdrinks = codr*35
38
Service_Charge.set(Service)
cost.set(costofmeal)
Tax.set(PaidTax)
Subtotal.set(costofmeal)
Total.set(OverAllCost)
def qexit():
c.destroy()
def reset():
rand.set("")
Fries.set("")
Largefries.set("")
Burger.set("")
Filet.set("")
Subtotal.set("")
Total.set("")
Service_Charge.set("")
Drinks.set("")
Tax.set("")
cost.set("")
Cheese_burger.set("")
39
but0 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="0",bg="black",com
mand=lambda:clickbut(0)).grid(row=4,column=0)
but1 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="1",bg="black",com
mand=lambda:clickbut(1)).grid(row=3,column=0)
but2 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="2",bg="black",com
mand=lambda:clickbut(2)).grid(row=2,column=0)
but3 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="3",bg="black",com
mand=lambda:clickbut(3)).grid(row=1,column=0)
but4 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="4",bg="black",com
mand=lambda:clickbut(4)).grid(row=3,column=1)
but5 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="5",bg="black",com
mand=lambda:clickbut(5)).grid(row=2,column=1)
but6 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="6",bg="black",com
mand=lambda:clickbut(6)).grid(row=1,column=1)
but7 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="7",bg="black",com
mand=lambda:clickbut(7)).grid(row=3,column=2)
but8 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="8",bg="black",com
mand=lambda:clickbut(8)).grid(row=2,column=2)
40
but9 =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="9",bg="black",com
mand=lambda:clickbut(9)).grid(row=1,column=2)
butsub = Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="-
",bg="black",command=lambda:clickbut("-")).grid(row=1,column=3)
butmul =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="*",bg="black",com
mand=lambda:clickbut("*")).grid(row=2,column=3)
butdiv =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="/",bg="black",com
mand=lambda:clickbut("/")).grid(row=3,column=3)
butadd =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="+",bg="black",com
mand=lambda:clickbut("+")).grid(row=4,column=3)
buteq =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="=",bg="black",com
mand=equals).grid(row=4,column=2)
butc =
Button(f2,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),text="C",bg="black",com
mand=clear).grid(row=4,column=1)
butabout= Button(f1,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),width =
10,text="About",bg="black",command=popupbonus).grid(row=12,column=3)
rand = StringVar()
Fries = StringVar()
Largefries = StringVar()
Burger = StringVar()
Filet = StringVar()
41
Subtotal = StringVar()
Total = StringVar()
Service_Charge = StringVar()
Drinks = StringVar()
Tax = StringVar()
cost = StringVar()
Cheese_burger = StringVar()
ord= Button(ftop,padx=16,pady=16,bd=10,fg="orange",font=('arial',10,'bold'),width =
20,text="Generate Order No.",bg="black",command=Random1).grid(row=8,column=0)
lblreference = Label(f1, font=( 'aria' ,16, 'bold' ),text="Order No.",fg="black",bd=10,anchor='w')
lblreference.grid(row=0,column=0)
txtreference = Entry(f1,font=('ariel' ,16,'bold'), textvariable=rand ,
bd=6,insertwidth=4,bg="orange" ,justify='right')
txtreference.grid(row=0,column=1)
42
lblburger = Label(f1, font=( 'aria' ,16, 'bold' ),text="Burger Meal",fg="black",bd=10,anchor='w')
lblburger.grid(row=3,column=0)
txtburger = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Burger ,
bd=6,insertwidth=4,bg="orange" ,justify='right')
txtburger.grid(row=3,column=1)
43
txtcost = Entry(f1,font=('ariel' ,16,'bold'), textvariable=cost , bd=6,insertwidth=4,bg="orange"
,justify='right')
txtcost.grid(row=1,column=3)
44
lblTotal = Label(f1,text="---------------------",fg="white")
lblTotal.grid(row=6,columnspan=3)
c.mainloop()
45
CHAPTER 3
3. RESULTS AND DISCUSSION
About Tkinter
The Tkinter module ("Tk interface") is the standard Python interface to the Tk GUI tool kit from
Scriptics (in the past made by Sun Labs).
Both Tk and Tkinter are available on most Unix stages, and also on Windows and Macintosh
systems. Starting with the 8.0 release, Tk offers nearby look and feel on all stages.
Tkinter involves different modules. The Tk interface is given by a parallel extension module
named _tkinter. This module contains the low-level interface to Tk, and should never be used
clearly by application programming engineers. It is typically a shared library (or DLL), yet may
now and again be statically associated with the Python middle person.
The overall public interface is given through different Python modules. The most imperative
interface module is just the Tkinter module. To use Tkinter, you should basically to import the
Tkinter module:
import Tkinter
46
The Tkinter module just charges widget classes and related constants, so you can safely
use the from-in casing all around. If you lean toward not to, yet rather still need to save
some making, you can use import-as:
import Tkinter as Tk
There are two fundamental strategies utilized you the client need to recall while making
the Python application with GUI:
tkinter likewise offers access to the geometric design of the widgets which can sort out the
widgets in the parent windows. There are predominantly three geometry director classes.
pack() method: It sorts out the widgets in squares before putting in the parent widget.
grid() method: It arranges the widgets in lattice (table-like structure) before setting in the
parent widget.
47
• place() method:It composes the widgets by putting them on particular positions
coordinated by the software engineer.
Widgets
There are various widgets which you can put in your tkinter application. A portion of the
significant widgets are clarified underneath:
3.1 Button:
w=Button(master, option=value)
There are number of alternatives which are utilized to change the arrangement of the Buttons.
Number of alternatives can be passed as parameters isolated by commas. Some of them are
recorded beneath.
48
Output:
3.2 Canvas:
49
height: to set the tallness of the widget.
Output:
3.3 CheckButton:
To choose any number of alternatives by showing various choices to a client as flip catches. The
general sentence structure is:
w = CheckButton(master, option=value)
There are number of alternatives which are utilized to change the configuration of this widget.
Number of choices can be passed as parameters isolated by commas. Some of them are recorded
underneath.
• activebackground: to set the foundation shading when widget is under the cursor.
• activeforeground: to set the closer view shading when widget is under the cursor.
50
• bg: to set the ordinary foundation
Example:
3.4 Entry:
It is utilized to include the single line content passage from the client.. For multi-line content
info, Text widget is utilized. The general sentence structure is:
w=Entry(master, option=value)
There are number of choices which are utilized to change the organization of the widget. Number
of alternatives can be passed as parameters isolated by commas. Some of them are recorded
underneath.
51
• cursor: to set the cursor utilized.
Output:
3.5 Frame:
It goes about as a compartment to hold the widgets. It is utilized for gathering and arranging the
widgets. The general language structure is:
w = Frame(master, option=value) master is the parameter used to speak to the parent window.
There are number of alternatives which are utilized to change the configuration of the widget.
Number of choices can be passed as parameters isolated by commas. Some of them are recorded
beneath.
52
• highlightcolor: To set the shade of the center feature when widget must be engaged.
Output:
3.6 Label:
It alludes to the showcase box where you can put any content or picture which can be refreshed
whenever according to the code. The general language structure is:
53
w=Label(master, option=value) master is the parameter used to speak to the parent window.
here are number of alternatives which are utilized to change the organization of the widget.
Number of choices can be passed as parameters isolated by commas. Some of them are recorded
underneath.
54
3.7 Listbox:
It offers a rundown to the client from which the client can acknowledge any number of choices.
w = Listbox(master, option=value) master is the parameter used to speak to the parent window.
There are number of alternatives which are utilized to change the organization of the widget.
Number of alternatives can be passed as parameters isolated by commas. Some of them are
recorded beneath.
• highlightcolor: To set the shade of the center feature when widget must be engaged.
55
CHAPTER 4
4.1 CONCLUSIONS
Python is setting down deep roots! Python programming preparing has seen expanding fame
among the majority and Linux people group is additionally being utilized by enormous players
like Google. Python is an exhaustive and significant abnormal state programming language which
is generally connected with Linux area of clients. It is an open source language loaning backing to
the principle programming codes that are in vogue. Best of all, python software engineers can
compose codes that can be protest situated, practical or basic in plan.
This language was outlined with an intend to give stage autonomy and code coherence as a primary
concern. These 2 remarkable highlights make this language intelligent and versatile and
additionally less demanding to get it. The adaptability that Python runs same source code on a
wide cluster of stages, which so ever it works makes it emerge of the jam in programming market
today, where significantly all different languages miss the mark. Python has been depicted as most
sorted out and institutionalized language by a few clients. With these amazing forces, and
compactness over numerous stages, this language guarantees a well manufactured vocation ahead
for every one of the wannabes.
In an ongoing overview directed online by Linux Journal, Python has been casted a ballot as a
standout amongst the most looked for after and most loved programming language beating any
56
semblance of C, C++ and JAVA. It is being considered as an essential for Linux occupations as
both Linux and Python world are open source and have a lot of cooperative energy between them.
It's adaptable, vigorous and far reaching programming language. It is being highlighted in the best
10 most well known programming languages being utilized in the business.
It has genuine compactness includes and can be utilized over a huge number of stages. This
adaptability and extensibility make it adored by software engineers.
Comprehension of Python demonstrates comprehension of Linux frameworks. Both the stages are
packaged together and Python goes about as a standard component for engineers and Linux
executives. . It is as a rule effectively utilized in a large number of business applications.
Being a free and open source, it is being favored over different options. It comprehends the ideas
and usage. Unquestionably, Python wouldn't blur away for the time being!
57
PLAGIARISM REPORTS
58