⽤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)
电脑编程工资多少
def calculator():
salary = ())
five_money = ())
one_base = ())
point = ())
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
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)