[Asm] 纯文本查看 复制代码
# coding=utf-8
"""
[url=home.php?mod=space&uid=155760]@Project[/url] :Learning
[url=home.php?mod=space&uid=267492]@file[/url] :costPerformance.py
[url=home.php?mod=space&uid=686208]@AuThor[/url] :Monklman
[url=home.php?mod=space&uid=686237]@date[/url] :2021/10/14 20:30
"""
import PySimpleGUI as sg
sg.theme('GreenMono')
layout = [
[sg.Text('月薪', font=('宋体', 14), justification='right', size=(8, 1)), sg.InputText(key='-salary-', size=(15, 1)),
sg.Text('月工作日', font=('宋体', 14), justification='right', size=(8, 1)), sg.InputText(key='-workday-', size=(15, 1))],
[sg.Text('工作环境', font=('宋体', 14), justification='right', size=(8, 1)),
sg.InputText(key='-work_env-', tooltip='普通环境(1.0);偏远的工厂/工地/艰苦户外(0.8);工厂/工地(0.9);CBD/体制内(1.1)', size=(15, 1)),
sg.Text('异性环境', font=('宋体', 14), justification='right', size=(8, 1)),
sg.InputText(key='-opposite_sex-', tooltip='好看的不多不少(1.0);没有好看的(0.9);很多好看的(1.1)', size=(15, 1))],
[sg.Text('同事环境', font=('宋体', 14), justification='right', size=(8, 1)),
sg.InputText(key='-workmates-', tooltip='基本为普通同事(1.0);脑残同事多(0.95);优秀同事多(1.05)', size=(15, 1))],
[sg.Text('工作时长', font=('宋体', 14), justification='right', size=(8, 1)),
sg.InputText(key='-work_hours-', tooltip='工作时长(小时)=下班时间-上班时间', size=(15, 1)),
sg.Text('通勤时长', font=('宋体', 14), justification='right', size=(8, 1)),
sg.InputText(key='-commute_hours-', tooltip='通勤时长(小时)=上班通勤+下班通勤', size=(15, 1))],
[sg.Text('摸鱼时长', font=('宋体', 14), justification='right', size=(8, 1)),
sg.InputText(key='-lazy_hour-', tooltip='摸鱼时长(小时)=划水+吃饭+午休', size=(15, 1))],
[sg.Text('学历系数', font=('宋体', 14), justification='right', size=(8, 1)),
sg.InputText(key='-education-', tooltip='专科及以下(0.8);普通本科(1.0);211/985本科(1.2);普通硕士(1.4);211/985硕士(1.6);普通博士(1.8);211/985博士(2.0)', size=(15, 1))],
[sg.Button('计算', size=(8, 1)), sg.Button('关闭', size=(8, 1))]
]
window = sg.Window(title='工作性比价', layout=layout, size=(450, 220), icon='cost32.ico')
while True:
event, values = window.read()
try:
if event in ['关闭', sg.WIN_CLOSED]:
break
elif event == '计算':
numerator = float(values['-salary-']) / float(values['-workday-']) * float(values['-work_env-']) * float(values['-opposite_sex-']) * float(values['-workmates-'])
denominator = 35 * (float(values['-work_hours-']) + float(values['-commute_hours-']) - 0.5 * float(values['-lazy_hour-'])) * float(values['-education-'])
cost = numerator / denominator
if cost >= 2:
sg.Popup('性价比系数:{:.2f}'.format(cost), '您这工作真是快活似神仙啊!!')
elif 1.5 <= cost < 2:
sg.Popup('性价比系数:{:.2f}'.format(cost), '这是一份不错的工作哦!!')
elif 0.8 <= cost < 1.5:
sg.Popup('性价比系数:{:.2f}'.format(cost), '您的工作普普通通,很稳定!!')
else:
sg.Popup('性价比系数:{:.2f}'.format(cost), '您要不要考虑换一个工作试试??')
except ValueError:
sg.Popup('输入有误,请重新输入')
window.close()