Project Computer
Project Computer
NEPAL
A Project Report
On
For
UTSAV PAUDYAL
CERTIFICATE
This is to certify that Utsav Paudyal, a student of Class XII A
has successfully completed the project on “Art And
Integration (GUI) Calculator ” mentioned under the guidance
of Sanjay Gopal Shestra ( Comp.Sc.) during the year 2020-21
in partial fulfillment of Computer Science Art Integration
Project.
Utsav Paudyal
Class XII A
OVERVIEW OF PYTHON
Python is a high-level, interpreted, interactive and object-oriented
scripting language. Python is designed to be highly readable. It uses
English keywords frequently where as other languages use
punctuation, and it has fewer syntactical constructions than other
languages.
Python is Interpreted − Python is processed at runtime by the
interpreter. You do not need to compile your program before executing
it. This is similar to PERL and PHP.
Python is Interactive − You can actually sit at a Python prompt and
interact with the interpreter directly to write your programs.
Python is Object-Oriented − Python supports Object-Oriented style or
technique of programming that encapsulates code within objects.
Python is a Beginner's Language − Python is a great language for the
beginner-level programmers and supports the development of a wide
range of applications from simple text processing to WWW browsers to
games.
History of Python
Python was developed by Guido van Rossum in the late eighties and
early nineties at the National Research Institute for Mathematics
and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC,
Modula-3, C, C++, Algol-68, SmallTalk, and Unix shell and other
scripting languages.
Python is copyrighted. Like Perl, Python source code is now available
under the GNU General Public License (GPL).
Python is now maintained by a core development team at the
institute, although Guido van Rossum still holds a vital role in
directing its progress.
Python Features
Python's features include −
Easy-to-learn − Python has few keywords, simple structure, and a
clearly defined syntax. This allows the student to pick up the language
quickly.
Easy-to-read − Python code is more clearly defined and visible to the
eyes.
Easy-to-maintain − Python's source code is fairly easy-to-maintain.
A broad standard library − Python's bulk of the library is very portable
and cross-platform compatible on UNIX, Windows, and Macintosh.
Interactive Mode − Python has support for an interactive mode which
allows interactive testing and debugging of snippets of code.
Portable − Python can run on a wide variety of hardware platforms and
has the same interface on all platforms.
Extendable − You can add low-level modules to the Python interpreter.
These modules enable programmers to add to or customize their tools
to be more efficient.
Databases − Python provides interfaces to all major commercial
databases.
GUI Programming − Python supports GUI applications that can be
created and ported to many system calls, libraries and windows
systems, such as Windows MFC, Macintosh, and the X Window system
of Unix.
Scalable − Python provides a better structure and support for large
programs than shell scripting.
Apart from the above-mentioned features, Python has a big list of
good features, few are listed below −
It supports functional and structured programming methods as well as
OOP.
It can be used as a scripting language or can be compiled to byte-code
for building large applications.
It provides very high-level dynamic data types and supports dynamic
type checking.
It supports automatic garbage collection.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
#============Creating A Window================#
me=Tk()
me.geometry("352x480")
me.title("CALCULATOR")
me.iconbitmap(r'C:\Users\DELL\Desktop\CALCULATOR PROJECT\ICON
PACK\favicon.ico')
melabel = Label(me,text="CALCULATOR",bg='red',font=("Times",30,'bold'))
melabel.pack(side=TOP)
me.config(background='powder blue')
def clickbut(number):
global operator
operator=operator+str(number)
textin.set(operator)
def equlbut():
global operator
add=str(eval(operator))
textin.set(add)
operator=''
def equlbut():
global operator
sub=str(eval(operator))
textin.set(sub)
operator=''
def equlbut():
global operator
mul=str(eval(operator))
textin.set(mul)
operator=''
def equlbut():
global operator
div=str(eval(operator))
textin.set(div)
operator=''
def clrbut():
textin.set('')
def _quit():
win.quit()
win.destroy()
exit()
def _filesave():
name=asksaveasfile(mode='w',defaultextension=".txt")
text2save=str(text.get(0.0,END))
name.write(text2save)
name.close
def openHelp():
openHelp = Toplevel(me)
openHelp.title("HELP/ ABOUT PROJECT ")
openHelp.geometry("490x500")
openHelp.iconbitmap(r'C:\Users\DELL\Desktop\CALCULATOR PROJECT\ICON
PACK\info.ico')
Label(openHelp,text ="This project has been made to demonstrate\n simple (GUI)
graphical user interface calculator via\n python. It is a program which a user can do
the \n multiplication, substraction , division, addition. Etc\n The features are similar to
a normal electric\n calculator with a (GUI) 3d design. It has a colourful\n number
keypad whth different colours . It also\n has different options to save your record
of\n calculator etc IT also has a display to display the\n output . At last this project
contains a, buttons, textbar, menubar.",font=("Times",11,'bold')).pack()
label.pack(pady = 10)
def make_menu(w):
global the_menu
the_menu = Tkinter.Menu(w, tearoff=0)
the_menu.add_command(label="Cut")
the_menu.add_command(label="Copy")
the_menu.add_command(label="Paste")
def show_menu(e):
w = e.widget
the_menu.entryconfigure("Cut",
command=lambda: w.event_generate("<<Cut>>"))
the_menu.entryconfigure("Copy",
command=lambda: w.event_generate("<<Copy>>"))
the_menu.entryconfigure("Paste",
command=lambda: w.event_generate("<<Paste>>"))
the_menu.tk.call("tk_popup", the_menu, e.x_root, e.y_root)
#=================MenuBar==============================#
menubar = Menu(me)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="New",)
filemenu.add_command(label="Open",)
filemenu.add_command(label="Save",)
filemenu.add_command(label="Close", command=quit )
filemenu.add_separator()
filemenu.add_command(label="Exit", command=quit)
menubar.add_cascade(label="File", menu=filemenu)
editmenu = Menu(menubar, tearoff=0)
editmenu.add_command(label="Undo",)
editmenu.add_separator()
editmenu.add_command(label="Cut", )
editmenu.add_command(label="Copy", )
editmenu.add_command(label="Paste", )
editmenu.add_command(label="Delete", )
editmenu.add_command(label="Select All", )
menubar.add_cascade(label="Edit", menu=editmenu)
helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label="Help Index", )
helpmenu.add_command(label="About..." )
menubar.add_cascade(label="Help",command = openHelp )
me.config(menu=menubar)
textin=StringVar()
operator=""
#===========================Textbox============================#
metext=Entry(me,font=("Courier
New",12,'bold'),textvar=textin,width=25,bd=5,bg='white')
metext.pack()
#======================Buttons===================================
===#
but1=Button(me,padx=14,pady=14,bd=4,bg='blue',command=lambda:clickbut(1),text
="1",font=("Courier New",16,'bold'))
but1.place(x=10,y=100)
but2=Button(me,padx=14,pady=14,bd=4,bg='green',command=lambda:clickbut(2),te
xt="2",font=("Courier New",16,'bold'))
but2.place(x=10,y=170)
but3=Button(me,padx=14,pady=14,bd=4,bg='pink',command=lambda:clickbut(3),text
="3",font=("Courier New",16,'bold'))
but3.place(x=10,y=240)
but4=Button(me,padx=14,pady=14,bd=4,bg='silver',command=lambda:clickbut(4),te
xt="4",font=("Courier New",16,'bold'))
but4.place(x=75,y=100)
but5=Button(me,padx=14,pady=14,bd=4,bg='brown',command=lambda:clickbut(5),te
xt="5",font=("Courier New",16,'bold'))
but5.place(x=75,y=170)
but6=Button(me,padx=14,pady=14,bd=4,bg='purple',command=lambda:clickbut(6),te
xt="6",font=("Courier New",16,'bold'))
but6.place(x=75,y=240)
but7=Button(me,padx=14,pady=14,bd=4,bg='lime',command=lambda:clickbut(7),text
="7",font=("Courier New",16,'bold'))
but7.place(x=140,y=100)
but8=Button(me,padx=14,pady=14,bd=4,bg='coral',command=lambda:clickbut(8),tex
t="8",font=("Courier New",16,'bold'))
but8.place(x=140,y=170)
but9=Button(me,padx=14,pady=14,bd=4,bg='gold',command=lambda:clickbut(9),text
="9",font=("Courier New",16,'bold'))
but9.place(x=140,y=240)
but0=Button(me,padx=14,pady=14,bd=4,bg='navy
blue',command=lambda:clickbut(0),text="0",font=("Courier New",16,'bold'))
but0.place(x=10,y=310)
butdot=Button(me,padx=47,pady=14,bd=4,bg='white',command=lambda:clickbut("."),
text=".",font=("Courier New",16,'bold'))
butdot.place(x=75,y=310)
butpl=Button(me,padx=14,pady=14,bd=4,bg='white',text="+",command=lambda:click
but("+"),font=("Courier New",16,'bold'))
butpl.place(x=205,y=100)
butsub=Button(me,padx=14,pady=14,bd=4,bg='white',text="-",command=lambda:clic
kbut("-"),font=("Courier New",16,'bold'))
butsub.place(x=205,y=170)
butml=Button(me,padx=14,pady=14,bd=4,bg='white',text="*",command=lambda:click
but("*"),font=("Courier New",16,'bold'))
butml.place(x=205,y=240)
butdiv=Button(me,padx=14,pady=14,bd=4,bg='white',text="/",command=lambda:click
but("/"),font=("Courier New",16,'bold'))
butdiv.place(x=205,y=310)
butclear=Button(me,padx=14,pady=119,bd=4,bg='white',text="CE",command=clrbut,
font=("Courier New",16,'bold'))
butclear.place(x=270,y=100)
butequal=Button(me,padx=151,pady=14,bd=4,bg='white',command=equlbut,text="="
,font=("Courier New",16,'bold'))
butequal.place(x=10,y=380)
me.mainloop()
OUTPUT SCREEN
1. Initial page
2. Addition
3. Subtraction
3. Multiplication
4. Division
BIBLIOGRAPHY
1. https://en.wikibooks.org
2. https://www.tutorialspoint.com
3. https://pythonspot.com/python-database-
programming-sqlite-tutorial/
4. https://www.w3schools.com
5. https://www.youtube.com