一、理论学习
1、完成慕课第六、七章的相关学习。
2、阅读《构建之法》讲义中的“需求”。
需求是人们要解决的某个问题或达到某种目的的需要,是作为系统开发、测试、验收和提交的正式文档依据。利用NABCD模型来分析项目开发的过程能有效的避免拍脑袋做决定,为项目开发提供良好的前提。需求发的获取有焦点小组、深入面谈、卡片分类用户调查问卷、用户日志研究、民族/人种研究、软件可用性研究、眼动跟踪研究、纸上模型调研和A/B测试等方式。其中各有优缺点,可以综合利用这些方式获取需求。
二、实践学习
1 # -*- coding: UTF-8 -*- 2 3 import json 4 import random 5 import tkinter as tk 6 7 8 def open_database(json_file): 9 f = open(json_file, encoding="utf-8") 10 poetry_dict = json.load(f) 11 return poetry_dict 12 13 14 def random_selection(): 15 record = [] 16 poetry_dict = open_database("poetry_database.json") 17 for i in range(100): 18 loc = random.randint(1, 30) 19 if loc not in record: 20 record.append(loc) 21 line_count = poetry_dict[loc - 1]["line"] 22 line_num = random.randint(1, line_count) 23 if len(record) == 1: 24 start_btn.place_forget() 25 random_keyword_1.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 26 elif len(record) == 2: 27 random_keyword_2.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 28 elif len(record) == 3: 29 random_keyword_3.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 30 elif len(record) == 4: 31 random_keyword_4.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 32 elif len(record) == 5: 33 random_keyword_5.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 34 elif len(record) == 6: 35 random_keyword_6.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 36 elif len(record) == 7: 37 random_keyword_7.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 38 elif len(record) == 8: 39 random_keyword_8.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 40 elif len(record) == 9: 41 random_keyword_9.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 42 elif len(record) == 10: 43 random_keyword_10.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 44 elif len(record) == 11: 45 random_keyword_11.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 46 elif len(record) == 12: 47 random_keyword_12.set(poetry_dict[loc - 1]["keyword"][line_num - 1]) 48 break 49 if loc in record: 50 continue 51 52 53 window = tk.Tk() 54 window.title("出口成诗小游戏") 55 window.geometry("500x300") 56 57 random_keyword_1 = tk.StringVar() 58 random_keyword_2 = tk.StringVar() 59 random_keyword_3 = tk.StringVar() 60 random_keyword_4 = tk.StringVar() 61 random_keyword_5 = tk.StringVar() 62 random_keyword_6 = tk.StringVar() 63 random_keyword_7 = tk.StringVar() 64 random_keyword_8 = tk.StringVar() 65 random_keyword_9 = tk.StringVar() 66 random_keyword_10 = tk.StringVar() 67 random_keyword_11 = tk.StringVar() 68 random_keyword_12 = tk.StringVar() 69 70 start_btn = tk.Button(window, text="开始游戏", font=('微软雅黑', 12, "bold"), width=10, height=1, command=random_selection 71 ) 72 start_btn.place(x=400, y=200) 73 lab_1 = tk.Label(window, textvariable=random_keyword_1, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 74 height=2, relief="raised", borderwidth=10).place(x=0, y=0) 75 lab_2 = tk.Label(window, textvariable=random_keyword_2, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 76 height=2, relief="raised", borderwidth=10).place(x=100, y=0) 77 lab_3 = tk.Label(window, textvariable=random_keyword_3, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 78 height=2, relief="raised", borderwidth=10).place(x=200, y=0) 79 lab_4 = tk.Label(window, textvariable=random_keyword_4, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 80 height=2, relief="raised", borderwidth=10).place(x=300, y=0) 81 lab_5 = tk.Label(window, textvariable=random_keyword_5, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 82 height=2, relief="raised", borderwidth=10).place(x=0, y=100) 83 lab_6 = tk.Label(window, textvariable=random_keyword_6, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 84 height=2, relief="raised", borderwidth=10).place(x=100, y=100) 85 lab_7 = tk.Label(window, textvariable=random_keyword_7, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 86 height=2, relief="raised", borderwidth=10).place(x=200, y=100) 87 lab_8 = tk.Label(window, textvariable=random_keyword_8, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 88 height=2, relief="raised", borderwidth=10).place(x=300, y=100) 89 lab_9 = tk.Label(window, textvariable=random_keyword_9, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 90 height=2, relief="raised", borderwidth=10).place(x=0, y=200) 91 lab_10 = tk.Label(window, textvariable=random_keyword_10, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 92 height=2, relief="raised", borderwidth=10).place(x=100, y=200) 93 lab_11 = tk.Label(window, textvariable=random_keyword_11, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 94 height=2, relief="raised", borderwidth=10).place(x=200, y=200) 95 lab_12 = tk.Label(window, textvariable=random_keyword_12, bg="red", fg="white", font=("微软雅黑", 14, "bold"), width=6, 96 height=2, relief="raised", borderwidth=10).place(x=300, y=200) 97 98 window.mainloop()
1 # Countdown using Tkinter 2 from tkinter import * 3 import time 4 import tkinter.messagebox 5 6 class App: 7 def __init__(self,master): 8 frame = Frame(master) 9 frame.pack() 10 self.entryWidget = Entry(frame) 11 self.entryWidget["width"] = 15 12 self.entryWidget.pack(side=LEFT) 13 self.hi_there = Button(frame, text="开始", command=self.start) 14 self.hi_there.pack(side=LEFT) 15 self.button = Button(frame, text="退出", fg="red", command=frame.quit) 16 self.button.pack(side=LEFT) 17 18 def start(self): 19 text = self.entryWidget.get().strip() 20 if text != "": 21 num = int(text) 22 self.countDown(num) 23 24 def countDown(self,seconds): 25 lbl1.config(bg='yellow') 26 lbl1.config(height=3, font=('times', 20, 'bold')) 27 for k in range(seconds, 0, -1): 28 lbl1["text"] = k 29 root.update() 30 time.sleep(1) 31 lbl1.config(bg='red') 32 lbl1.config(fg='white') 33 lbl1["text"] = "时间到!" 34 tkinter.messagebox.showinfo("时间到!","时间到!") 35 36 37 def closewindow(): 38 if tkinter.messagebox.askokcancel("Quit", "Do you want to exit?"): 39 root.destroy() 40 41 42 root = Tk() 43 root.title("Countdown") 44 lbl1 = Label() 45 lbl1.pack(fill=BOTH, expand=1) 46 app = App(root) 47 root.protocol('WM_DELETE_WINDOW', closewindow) 48 root.mainloop()
总结:
三、学习记录
学习阶段 | 学习内容 | 学习收获 |
2019.3.17 14:00-17:00 | 软件工程 | 对需求以及配置管理有了一定了解 |
2019.3.18 14:00-17:00 | 《构建之法》讲义 | 进一步了解需求 |
2019.3.19 14:00-17:00 | python基础学习 | 学习python的基本语法 |
2019.3.20 09:00-17:00 | 实践学习 | 构建诗词数据库 |
2019.3.21 09:00-2100
|
实践学习 | 编写实践模块程序 |