2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 用python计算工资工资_python小编程------交互界面计算工资(五险一金不按比例缴纳)...

用python计算工资工资_python小编程------交互界面计算工资(五险一金不按比例缴纳)...

时间:2023-10-28 08:57:12

相关推荐

用python计算工资工资_python小编程------交互界面计算工资(五险一金不按比例缴纳)...

# coding:utf-8

from Tkinter import *

root = Tk()

Label(root, text='应发总工资 :').grid(row=0, column=0) # 对Label内容进行表格式布局

Label(root, text='五种保险费 :').grid(row=1, column=0)

Label(root, text='住房公积金 :').grid(row=2, column=0)

Label(root, text='个税起征点 :').grid(row=3, column=0)

Label(root, text='你拥有财富 :').grid(row=4, column=0)

v1 = StringVar() # 设置变量 .

v2 = StringVar()

v3 = StringVar()

v4 = StringVar()

v5 = StringVar()

e1 = Entry(root, textvariable=v1, show='$') # 用于储存 输入的内容

e2 = Entry(root, textvariable=v2)

e3 = Entry(root, textvariable=v3)

e4 = Entry(root, textvariable=v4)

e5 = Entry(root, textvariable=v5)

e1.grid(row=0, column=1, padx=10, pady=5) # 进行表格式布局 .

e2.grid(row=1, column=1, padx=10, pady=5)

e3.grid(row=2, column=1, padx=10, pady=5)

e4.grid(row=3, column=1, padx=10, pady=5)

e5.grid(row=4, column=1, padx=10, pady=5)

def calculator():

salary = int(e1.get())

five_money = int(e2.get())

one_base = int(e3.get())

point = int(e4.get())

five_one_money = five_money + one_base

rest_money = salary - five_one_money - point

res_money = salary - five_one_money

if rest_money <= 1500:

res_money -= rest_money * 0.03

v5.set(res_money)

elif 1500 < rest_money <= 4500:

tax_money = rest_money * 0.1

res_money -= tax_money - 105

v5.set(res_money)

elif 4500 < rest_money <= 9000:

tax_money = rest_money * 0.2

res_money -= tax_money - 555

v5.set(res_money)

elif 9000 < rest_money <= 35000:

tax_money = rest_money * 0.25

res_money -= tax_money - 1005

v5.set(res_money)

elif 35000 < rest_money <= 55000:

tax_money = rest_money * 0.3

res_money -= tax_money - 2755

v5.set(res_money)

elif 55000 < rest_money <= 80000:

tax_money = rest_money * 0.35

res_money -= tax_money - 5505

v5.set(res_money)

else:

tax_money = rest_money * 0.45

res_money -= tax_money - 13505

v5.set(res_money)

print u'税前工资为:{0},税后工资为:{1}'.format(salary, res_money)

Button(root, text='点击得财宝', width=10, command=calculator).grid(row=5, column=0, sticky=W, padx=10, pady=5)

Button(root, text='可以退出来', width=10, command=root.quit).grid(row=5, column=1, sticky=E, padx=10, pady=5)

mainloop()

注:Label(root, fg='blue', bg='green', text='你拥有财富 :').grid(row=4, column=0)可以加上颜色

也可以加上图片:格式一定是gif格式

photo = PhotoImage(file='e:\\123.gif')

label = Label(image=photo)

label.image = photo

label.grid(row=0, column=2, columnspan=2, rowspan=4, sticky=W+E+N+S, padx=10, pady=10)

Button(root, text='点击得财宝', width=10, command=calculator).grid(row=4, column=2, sticky=W, padx=10, pady=5)

Button(root, text='可以藏起来', width=10, command=root.quit).grid(row=4, column=3, sticky=E, padx=10, pady=5)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。