Skip to content

Commit 6a33b9c

Browse files
authored
Update gui.py
1 parent ee4ef0f commit 6a33b9c

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

gui.py

+26-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@
88
import openai
99
import os
1010

11+
print('''
12+
__ __ __ __
13+
/ // /__ _/ /__ ___ ____ ___/ /
14+
/ _ / _ `/ / _ \/ _ `/ -_) _ /
15+
/_//_/\_,_/_/\___/\_, /\__/\_,_/
16+
/___/
17+
''')
18+
19+
def jcgx():
20+
vertion=requests.get("https://tinywebdb.appinventor.space/api?user=haloged&secret=463de003&action=get&tag=bbh")
21+
vertion_jx=json.loads(vertion.text)
22+
bbh=vertion_jx["bbh"]
23+
if bbh=="1.1.0":
24+
tkinter.messagebox.showinfo("提示","无更新")
25+
else:
26+
tip_vertion=tkinter.messagebox.askyesno("提示","有新版本!\n点击“确定”转到仓库")
27+
if tip_vertion==True:
28+
os.system("start https://github.com/haloged/get_hitokoto/releases")
29+
def ope_github():
30+
os.system("start https://github.com/haloged/get_hitokoto/")
1131
def ope():
1232
os.system("log.txt")
1333
def about():
@@ -58,7 +78,7 @@ def run_1():
5878
elif yuan==3:
5979
with open("log.txt","a") as f:
6080
f.write("获取源:ChatGPT\n抓取次数:"+str(run_num)+"\n\n")
61-
gpt_api_token=tkinter.simpledialog.askstring("请输入你的OPENAI API KEY")
81+
gpt_api_token=tkinter.simpledialog.askstring(title="请输入你的你的KEY",prompt="请输入你的OPENAI API KEY")
6282
openai.api_key = os.getenv(gpt_api_token)
6383
response = openai.Completion.create(model="text-davinci-003", prompt="请生成"+run_num+"个关于励志的句子", temperature=0, max_tokens=1000)
6484
print(response)
@@ -69,7 +89,7 @@ def run_1():
6989
tkinter.messagebox.showinfo("提示","获取成功!")
7090

7191
root=tk.Tk()
72-
root.title("一言生成器v1.0.0 By Haloged")
92+
root.title("一言生成器v1.1.0 By Haloged")
7393
root.geometry("500x300")
7494

7595
mainmenu = tk.Menu(root)
@@ -80,7 +100,9 @@ def run_1():
80100
menuFile.add_command(label="退出",command=root.destroy)
81101

82102
menuEdit = tk.Menu(mainmenu) # 菜单分组 menuEdit
83-
mainmenu.add_cascade(label="关于",menu=menuEdit)
103+
mainmenu.add_cascade(label="更多",menu=menuEdit)
104+
menuEdit.add_command(label="Github仓库",command=ope_github)
105+
menuEdit.add_command(label="检查更新",command=jcgx)
84106
menuEdit.add_command(label="关于",command=about)
85107
root.config(menu=mainmenu)
86108

@@ -112,4 +134,4 @@ def run_1():
112134
rd4 = tk.Radiobutton(root,text="ChatGPT(需自行提供API KEY)",variable=var,value=3)
113135
rd4.pack()
114136

115-
root.mainloop()
137+
root.mainloop()

0 commit comments

Comments
 (0)