Tax ক্যালকুলেটর (বাৎসরিক মোট আয়, আবাসন ব্যয়, চিকিৎসা ব্যয়, সঞ্চয়/বিনিয়োগ ব্যয় ইনপুট এর মাধ্যমে ব্যক্তির প্রদেয় আয়কর এর হিসেব পাওয়া যাবে )
import tkinter as tk
from tkinter import ttk, messagebox
def calculate_tax():
try:
income = float(income_entry.get())
investment = float(investment_entry.get())
area = area_combobox.get().lower()
# Calculate basic tax based on income
if income <= 300000:
tax = 0
elif income <= 500000:
tax = (income - 300000) * 0.15
elif income <= 1000000:
tax = (500000 - 300000) * 0.15 + (income - 500000) * 0.10
else:
tax = (500000 - 300000) * 0.15 + (1000000 - 500000) * 0.10 + (income - 1000000) * 0.05
# Apply investment deductions
if investment <= 150000:
tax -= investment * 0.15
elif investment <= 450000:
tax -= 150000 * 0.15 + (investment - 150000) * 0.10
else:
tax -= 150000 * 0.15 + 300000 * 0.10 + (investment - 450000) * 0.05
# Minimum tax based on area if income > 299999
if income > 299999:
if area == 'urban':
minimum_tax = 5000
elif area == 'rural':
minimum_tax = 3000
else:
minimum_tax = 0
else:
minimum_tax = 0
# The payable tax should not be less than the minimum tax for the area
payable_tax = max(tax, minimum_tax)
total_income.set(f"Total Income: ₹{income:.2f}")
payable_tax_str.set(f"Payable Tax: ₹{payable_tax:.2f}")
except ValueError:
messagebox.showerror("Input Error", "Please enter valid numerical values for income and investment.")
# GUI Setup
root = tk.Tk()
root.title("Income Tax Calculator")
tk.Label(root, text="Income:").grid(row=0, column=0, padx=10, pady=5)
income_entry = tk.Entry(root)
income_entry.grid(row=0, column=1, padx=10, pady=5)
tk.Label(root, text="Investment:").grid(row=1, column=0, padx=10, pady=5)
investment_entry = tk.Entry(root)
investment_entry.grid(row=1, column=1, padx=10, pady=5)
tk.Label(root, text="Area:").grid(row=2, column=0, padx=10, pady=5)
areas = ['Urban', 'Rural']
area_combobox = ttk.Combobox(root, values=areas)
area_combobox.grid(row=2, column=1, padx=10, pady=5)
area_combobox.current(0)
tk.Button(root, text="Calculate Tax", command=calculate_tax).grid(row=3, columnspan=2, pady=10)
total_income = tk.StringVar()
tk.Label(root, textvariable=total_income).grid(row=4, columnspan=2, pady=5)
payable_tax_str = tk.StringVar()
tk.Label(root, textvariable=payable_tax_str).grid(row=5, columnspan=2, pady=5)
root.mainloop()