Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6c2a26b

Browse files
Merge pull request #752 from baljeet-singh97/main
Income Tax Calculator
2 parents 61e86a1 + 2a4f266 commit 6c2a26b

File tree

4 files changed

+184
-0
lines changed

4 files changed

+184
-0
lines changed
210 KB
Loading[フレーム]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#income-Tax-Calculator
2+
3+
## Aim
4+
5+
here is basic GUI based income tax calculator written in python language all
6+
the parameters used here are not correct just on internet search basis just pull
7+
the code and update the creteria of tax and use it anyone can contribute this to upgrade
8+
it or if willingly to make changes just fork it make changes and pull req.
9+
10+
## Purpose
11+
12+
here the default values are used, user can change the values accouding to the current govt. tax deduction creteria.
13+
people can use this app to calculate there tax amount to be paid.
14+
simple and easy to use.
15+
16+
## Short description of package/script
17+
18+
- used tkinter library for giving GUI touch to the script
19+
20+
## Workflow of the Project
21+
- used jupyter notebook for the project
22+
- used tkinter library for gui
23+
- used default values for calculating the tax
24+
- user can type values by clicking on the screen as 1 - 9 digits are added
25+
- added clear button to calculate new data.
26+
27+
28+
## Setup instructions
29+
30+
In order to get started we need to install the following library by using the pip command
31+
pip install tkinter
32+
33+
After installing this library we need to create an app.py file and copy paste the following code
34+
income_tax_calculator.py
35+
36+
37+
## Compilation Steps
38+
39+
here we are using jupyter compiler for the project .
40+
just run the script by clicking on run button.
41+
42+
43+
## Output
44+
45+
<img src="https://github.com/baljeet-singh97/Awesome_Python_Scripts/blob/f7a97575000a32c3d79f934233992f5bf497f4f7/GUIScripts/Income%20Tax%20Calculator/Images/Screenshot%20(836).png" alt="Hello world">
46+
47+
## Author(s)
48+
49+
- [Baljeet Singh](https://www.linkedin.com/in/baljeet-singh97/)
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# import all functions/classes from the tkinter
2+
from tkinter import *
3+
from tkinter import ttk
4+
5+
exp = " "
6+
def press(num):
7+
global exp
8+
exp+=str(num)
9+
equation.set(exp)
10+
11+
# Function for clearing the
12+
# contents of all text entry boxes
13+
def clear ():
14+
global exp
15+
exp = " "
16+
equation.set(" ")
17+
18+
#function to calculate the tax it values are default , could varie from time to time.
19+
def taxamount(income):
20+
totalamount=0
21+
tax=0
22+
if income <= 500000:
23+
tax = 0
24+
25+
elif income <= 1000000:
26+
tax = 12500 + (income) * 0.20
27+
28+
elif income >= 1000001:
29+
tax = 112500 + (income) * 0.30
30+
else:
31+
tax = 12500+100000+(income - 1000000)* 0.3
32+
33+
totalamount=tax
34+
return totalamount
35+
36+
# take a value from the respective entry boxes
37+
# get method returns current text as string
38+
def butter():
39+
income=IntVar()
40+
income=incomefield.get()
41+
entryField.delete(0,'end')
42+
amount = taxamount(int(income))
43+
print(amount)
44+
entry.set(str(amount))
45+
46+
47+
# Create a GUI window
48+
root=Tk()
49+
50+
51+
# Set the background colour of GUI window
52+
root.configure(background="lightgrey")
53+
root.resizable(0,0)
54+
55+
# Set the configuration of GUI window
56+
root.geometry('300x280')
57+
58+
# set the name of tkinter GUI window
59+
root.title("income Tax Calculator")
60+
61+
entry= StringVar()
62+
equation = StringVar()
63+
64+
# *************************************************************************
65+
inputField = Frame(root)
66+
inputField.place(x=20,y=10)
67+
68+
# Create a Original your income: label
69+
labelincome = Label(inputField,text="Your Income",background="royalblue",width=12,foreground="White")
70+
labelincome.grid(row=0, column=0)
71+
incomefield = Entry(inputField,textvariable = equation, width = 20,background="SkyBlue2",foreground="black",justify=CENTER)
72+
incomefield.grid(row=0,column=1)
73+
74+
# Create a Original Total tax: label
75+
totaltax = Label(inputField,text="Total Tax",background="royalblue",width=12,foreground="white")
76+
totaltax.grid(row=1,column=0)
77+
entryField = Entry(inputField,textvariable = entry, width = 20,background="Yellowgreen",foreground="black",justify=CENTER)
78+
entryField.grid(row=1,column=1)
79+
80+
# *************************************************************************
81+
findTaxFrame = Frame(root)
82+
findTaxFrame.place(x=20,y=80)
83+
84+
# Create a Button to click to make the caculation.
85+
button = Button(findTaxFrame,text="Find Income Tax", width = 30,activebackground="cyan",background='skyblue', command=butter)
86+
button.grid(row=2,column=0,columnspan=3)
87+
88+
# *************************************************************************
89+
90+
#Creating the buttons from 1 - 9 and 0 in GUI window to enter the number.
91+
numpadFrame = Frame(root)
92+
numpadFrame.place(x=20,y=120)
93+
94+
btn9 = ttk.Button(numpadFrame, text = '9' , width = 10 , command = lambda : press(9) )
95+
btn9.grid(row=0,column=0)
96+
97+
btn8 = ttk.Button(numpadFrame, text = '8' , width = 10 , command = lambda : press(8) )
98+
btn8.grid(row=0,column=1)
99+
100+
btn7 = ttk.Button(numpadFrame, text = '7' , width = 10 , command = lambda : press(7) )
101+
btn7.grid(row=0,column=2)
102+
103+
btn6 = ttk.Button(numpadFrame, text = '6' , width = 10 , command = lambda : press(6) )
104+
btn6.grid(row=1,column=0)
105+
106+
btn5 = ttk.Button(numpadFrame, text = '5' , width = 10 , command = lambda : press(5) )
107+
btn5.grid(row=1,column=1)
108+
109+
btn4 = ttk.Button(numpadFrame, text = '4' , width = 10 , command = lambda : press(4) )
110+
btn4.grid(row=1,column=2)
111+
112+
btn3 = ttk.Button(numpadFrame, text = '3' , width = 10, command = lambda : press(3) )
113+
btn3.grid(row=2,column=0)
114+
115+
btn2 = ttk.Button(numpadFrame, text = '2' , width = 10, command = lambda : press(2) )
116+
btn2.grid(row=2,column=1)
117+
118+
btn1 = ttk.Button(numpadFrame, text = '1' , width = 10 , command = lambda : press(1) )
119+
btn1.grid(row=2,column=2)
120+
121+
zeroAndClearFrame = Frame(root)
122+
zeroAndClearFrame.place(x=20,y=220)
123+
124+
btn0= ttk.Button(zeroAndClearFrame, text = '0' , width = 10, command = lambda : press(0) )
125+
btn0.grid(row=3,column=0)
126+
127+
#Creating the buttons CLEAR to clear the txt boxes.
128+
btnclr = Button(zeroAndClearFrame, text = 'Clear' , width = 19, background='orange', activebackground='red',activeforeground='white', command = clear )
129+
btnclr.grid(row=3,column=1)
130+
131+
# Start the GUI
132+
root.mainloop()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1. need to be installed any python compiler , prferred use jupyter
2+
3+
2. Importing the module – tkinter

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /