用户:
大黄鸡hh_yjc查看:1 回复:1 评论:1 创建时间:2022-01-21T20:13:01
【作品展示】

【作品介绍】
【作品源代码】
from tkinter import filedialog as f
from tkinter import messagebox as m
import tkinter as tk
import random,os
dic = {}
root=tk.Tk()
root.title('警告')
def on_closing():
print('')
root.protocol("WM_DELETE_WINDOW", on_closing)
root.wm_attributes('-topmost',1);tk.Label(root,text='选择保存路径',bg='yellow',fg='blue').pack()
tk.Label(root,bitmap='hourglass',bg='yellow',fg='blue').pack()
l = f.asksaveasfilename(filetypes=[('.docx', '.docx')], title='保存路径')+'.docx'
s1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
index = random.randint(0, 25)
for count in range(1,101):
if count%9 == 0:
dic[count] = s1[index]
elif count%9 != 0:
dic[count] = s1[random.randint(0,25)]
try:
with open(l,'w+') as w:
w.write(str(dic).replace(',', '\n '))
except FileNotFoundError:
m.showwarning('错误','找不到路径'+l)
m.showwarning('提示', '请在1~100之间选择一个随机数,减去他的所有位之和!写在控制台!')
input('数字:')
print('我猜是\n',s1[index])
root.destroy()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn