From 2c066e709dc2229db2bad1baf1090827309936cc Mon Sep 17 00:00:00 2001 From: pcafzw7pf <3033465407@qq.com> Date: Fri, 31 May 2024 15:06:51 +0800 Subject: [PATCH] ADD file via upload --- fake_chat/chat2.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 fake_chat/chat2.py diff --git a/fake_chat/chat2.py b/fake_chat/chat2.py new file mode 100644 index 0000000..8d547e5 --- /dev/null +++ b/fake_chat/chat2.py @@ -0,0 +1,24 @@ +import tkinter as tk + + +def run(): + # 创建新的tk界面 + history_window = tk.Tk() + history_window.title("历史对话") + + # 读取历史对话内容 + dialogue_lines = [] + with open("dialogue.txt", "r") as file: + dialogue_lines = file.readlines() + + # 显示历史对话内容 + message_history = tk.Text(history_window, width=60, height=20, wrap="word") + message_history.pack(pady=10) + for line in dialogue_lines: + message_history.insert(tk.END, line) + + history_window.mainloop() + + +if __name__ == "__main__": + run() \ No newline at end of file