副问题[/!--empirenews.page--]
【线上直播】11月21日晚8点贝壳技能总监侯圣文《数据安详之数据库安详黄金法例》
云云不平衡的贫富差距,各行业的率领者怎样能打点好公司,让员工们即全力产出,又能安于近况呢?每个率领者必学的一门课程就是职场生理学。只有你充实相识员工生理与对应的举动示意,才气从容的掌控种种型的职员,从而到达“物尽其用”。
那么职场生理学到底进修什么?
九型人品
九型人品是一个连年来倍受国际闻名大学MBA学员推许的课程之一,近十几年来已盛行西欧学术界及工商界。
环球500强企业的打点阶级均有研习九型性格,并以此培训员工,成立团队,进步执行力。在今世,它对付企业的前期筹划、计谋确定、锻练指导、企业培训等方面,九型人品有很大的上风。
九型人品不只仅是一种精妙的性格说明器材,更首要的是为小我私人涵养、自我晋升和历练提供更深入的洞察力。
俗话说:“龙生九子,子子差异”。通过九型人品的性格说明器材,将性格生理与举动分别为九类。再对差异性格的人群举办研究说明,找到每一类人最得当岗亭与职责。这就是率领者们运筹于帷幄之中,决胜于千里之外的筹码。
工钱刀俎,我为鱼肉。不想受制于率领者们的掌控,起主要相识自身的人品分类,才气完美本身的不敷。这该怎样动手?作为措施员,让我们用代码完成自我的救赎吧!
代码改变天下
方才已往的华为HR变乱,给我印象最深的不是各阶级的抵牾,而是那位HR说的一句话:
在每位开拓的心中,都曾有着一个代码改变天下的愿望!
那么本日,我们就用Python开拓一套九型人品性格说明器材。用以让更多的人,相识本身的性格分类!
既然是九型人品说明,起首我们必要拿到它的测试题。翻了好久,知道了百度文库的测试原题:
https://wenku.baidu.com/view/19455024dd36a32d72758105.html
测试题总共36道,通过各场景下的举动示意,最终说明出你最靠近的人品分类。此刻题有了,怎样做出测试题呢?我选择行使Python的tkinter模块,将测试题开拓为一个可执行的exe器材,说干就干!
基本筹备
为了能将代码打包成单独的可执行文件,我们必要先筹备测试题与对应的谜底,然后提前存储在代码中。我们必要举办相干拆分,这种夫役活就交给拥有雷锋精力的我来完成吧:
界面开拓
界面无需过分伟大,提供声名、标题、选项作答、标题切换与操纵按钮即可。虽然,交卷后,必要表现用户的测试功效,那么开始吧!
30 minutes later…完成!
Main.py
- 1from Enneagram_GUI import *
- 2from tkinter import *
- 3
- 4
- 5def center_window(root, width, height):
- 6 screenwidth = root.winfo_screenwidth()
- 7 screenheight = root.winfo_screenheight()
- 8 size = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
- 9 root.geometry(size)
- 10
- 11
- 12root = Tk()
- 13
- 14center_window(root, 750, 700)
- 15
- 16root.resizable(width=False, height=False)
- 17root.title('九型人品测试 | 公家号: 清风Python')
- 18ExamPage(root)
- 19root.mainloop()
Enneagram_GUI.py
- 1# -*- coding: utf-8 -*-
- 2# @Author : 王翔
- 3# @微信号 : King_Uranus
- 4# @公家号 : 清风Python
- 5# @GitHub : https://github.com/BreezePython
- 6# @Date : 2019/11/12 23:12
- 7# @Software : PyCharm
- 8# @version :Python 3.7.3
- 9# @File : Enneagram_GUI.py
- 10
- 11
- 12# coding:utf-8
- 13from tkinter import *
- 14import Enneagram_Exam
- 15import Enneagram_Result
- 16import tkinter.messagebox
- 17
- 18# 自测声名
- 19Standard = '此份问卷共有36道测试标题,请在每题中选择你以为最适当可能最靠近描写本身的性格举动的句子,n'
- 20 '请所有作答,最高分的项目很也许成为你的基天性格型态。'
- 21
- 22# 人品范例矩阵
- 23Style_Dict = [
- 24 {3: 2, 6: 2, 10: 2, 15: 2, 19: 1, 22: 2, 28: 2, 32: 2},
- 25 {1: 1, 6: 1, 12: 1, 17: 2, 20: 1, 23: 1, 29: 1, 33: 1},
- 26 {4: 1, 7: 1, 10: 1, 14: 2, 23: 2, 26: 2, 30: 1, 34: 1},
- 27 {2: 1, 8: 2, 12: 2, 16: 1, 21: 2, 24: 1, 28: 1, 34: 2},
- 28 {1: 2, 4: 2, 13: 1, 16: 2, 19: 2, 25: 1, 31: 1, 36: 1},
- 29 {5: 1, 9: 2, 14: 1, 18: 1, 21: 1, 25: 2, 29: 2, 32: 1},
- 30 {2: 2, 7: 2, 11: 2, 18: 2, 22: 1, 27: 2, 33: 2, 36: 2},
- 31 {3: 1, 9: 1, 13: 2, 17: 1, 24: 2, 27: 1, 20: 2, 35: 2}
- 32]
- 33
- 34
- 35class ExamPage:
- 36 def __init__(self, master=None):
- 37 self.root = master
- 38 # 用户功效集
- 39 self.user_result = {}
- 40 self.status = 1
- 41 self.All_Exam = Enneagram_Exam
- 42 self.normal_choice = IntVar()
- 43 self.start_exam()
- 44
- 45 # 上一题要领
- 46 def before(self):
- 47 if self.normal_choice.get() != 0:
- 48 self.user_result[self.status] = self.normal_choice.get()
- 49 if self.status > 1:
- 50 self.status -= 1
- 51 self.body.grid_forget()
- 52 self.main_exam()
- 53 else:
- 54 tkinter.messagebox.showwarning("提醒:", message="请先选择谜底!")
- 55
- 56 # 下一题要领
- 57 def after(self):
- 58 if self.normal_choice.get() != 0:
- 59 self.user_result[self.status] = self.normal_choice.get()
- 60 if self.status < len(Enneagram_Exam.Exam):
- 61 self.status += 1
- 62 self.body.grid_forget()
- 63 self.main_exam()
- 64 else:
- 65 tkinter.messagebox.showwarning("提醒:", message="请先选择谜底!")
- 66
- 67 # 获取当前标题
- 68 def exam_files(self, num):
- 69 return list(map(lambda x: x.split('.'), self.All_Exam.Exam[num - 1].strip().split('n')))
- 70
- 71 # 交卷
- 72 def hand_paper(self):
- 73 self.user_result[self.status] = self.normal_choice.get()
- 74 if len(self.user_result) != 36:
- 75 tkinter.messagebox.showwarning("提醒:", message="您尚有未完成的测试题!")
- 76 else:
- 77 self.exam_result = LabelFrame(self.root, text="测试功效", padx=10, pady=10, fg="red", font=("黑体", '11'))
- 78 self.exam_result.grid(padx=10, pady=5, sticky=NSEW)
- 79 sc = Scrollbar(self.exam_result)
- 80 sc.grid(row=0, column=1, sticky=NS)
- 81 result_info = Text(self.exam_result, font=("黑体", '11'), width=85, yscrollcommand=sc.set)
- 82 result_info.grid(row=0, column=0, sticky=NSEW)
- 83 sc.config(command=result_info.yview)
- 84 all_num = []
- 85 for style in Style_Dict:
- 86 calc_num = list(
- 87 point for point in self.user_result if point in style and self.user_result[point] == style[point])
- 88 if calc_num == None:
- 89 all_num.append(0)
- 90 else:
- 91 all_num.append(len(calc_num))
- 92 user_type = all_num.index(max(all_num))
- 93 for line in Enneagram_Result.Result[user_type]:
- 94 result_info.insert(END, line)
- 95
- 96 # 启动测试所需节制按钮
- 97 def start_exam(self):
- 98 self.title = LabelFrame(self.root, text="自测声名", padx=10, pady=10, fg="red", font=("黑体", '11'))
- 99 self.title.grid(padx=10, pady=5)
- 100 note = Label(self.title, text=Standard, justify=LEFT, font=("黑体", '11'))
- 101 note.grid()
- 102 self.show = LabelFrame(self.root, text="选项", padx=10, pady=10, fg="red", font=("黑体", '11'))
- 103 self.show.grid(padx=10, pady=5, sticky=EW)
- 104 go_back = Button(self.show, text="上一题", width=8, command=lambda: self.before())
- 105 go_back.grid(row=4, column=0, padx=5, pady=10)
- 106 to_forword = Button(self.show, text="下一题", width=8, command=lambda: self.after())
- 107 to_forword.grid(row=4, column=1, padx=5, pady=10, sticky=E)
- 108 hand_in = Button(self.show, text="交卷", width=8, command=lambda: self.hand_paper())
- 109 hand_in.grid(row=4, column=2, padx=5, pady=10, sticky=E)
- 110 exit_sys = Button(self.show, text="退出", width=8, command=lambda: sys.exit())
- 111 exit_sys.grid(row=4, column=3, padx=5, pady=10, sticky=E)
- 112 self.main_exam()
- 113
- 114 # 测试题主界面
- 115 def main_exam(self):
- 116 self.normal_choice.set(0)
- 117 self.body = LabelFrame(self.root,
- 118 text="测试题 第%s题,剩余%s题" % (self.status, (len(Enneagram_Exam.Exam) - self.status)),
- 119 padx=10, pady=10, fg="red", font=("黑体", '11'))
- 120 self.body.grid(padx=10, pady=5, sticky=EW)
- 121 for option, choice in self.exam_files(self.status):
- 122 authority_choice = Radiobutton(self.body, text=choice, variable=self.normal_choice, value=option)
- 123 authority_choice.grid(row=option, sticky=W)
- 124 Label(self.body, text=" 第%s道题,用户选择的功效是:" % self.status, fg="red", font=("黑体", '11')).grid(row=3, column=0,
- 125 sticky=W)
- 126 Label(self.body, textvariable=self.normal_choice).grid(row=3, column=0, sticky=E)
剩余的操练题与谜底代码,就不在这里赘述了。
(编辑:河北网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|