- 创建 .idea 目录和相关配置文件,设置项目结构 - 添加多个课堂成果示例代码,涵盖不同主题和功能 - 创建和配置 .gitignore 文件,忽略特定文件和目录
39 lines
727 B
Python
39 lines
727 B
Python
'''【课后作业要求】
|
||
挑战一:
|
||
|
||
运用学到的知识对作品进行如下调整:
|
||
|
||
1.设置窗口为宽度可调整,高度不可调整
|
||
|
||
2.设置标签字体为“宋体”
|
||
|
||
3.设置标签背景色(黑、红、黄任选一)
|
||
|
||
黑色“black”,bg="black"
|
||
|
||
红色“red”,bg="red"
|
||
|
||
黄色“yellow”,bg="yellow"
|
||
|
||
'''
|
||
import tkinter as tk
|
||
import time
|
||
|
||
root = tk.Tk()
|
||
root.title('大聪明的时钟')
|
||
root.geometry('400x80+400+400')
|
||
root.resizable(width=True,height=False)
|
||
|
||
def update_clock():
|
||
now = time.strftime('%H:%M:%S')
|
||
label.config(text=now)
|
||
root.after(1000,update_clock)
|
||
|
||
label = tk.Label(text='',font=('宋体',60),fg='blue',bg='yellow')
|
||
label.pack()
|
||
update_clock()
|
||
|
||
root.mainloop()
|
||
|
||
|