# start_menu.py import tkinter as tk import jiyi # 你的游戏模块(包含 start_game) def show_start_window(): def start_game(rows, cols): print(f"游戏启动:{rows}行 x {cols}列") root.destroy() jiyi.start_game(rows, cols) root = tk.Tk() root.title("字母翻牌游戏 - 开始界面") root.geometry("600x500") tk.Label(root, text="请选择游戏难度", font=("Arial", 18)).pack(pady=20) difficulty = tk.StringVar(value="8x8") for option in ["6x6", "8x8", "10x10"]: tk.Radiobutton(root, text=option, variable=difficulty, value=option, font=("Arial", 16)).pack(anchor="w", padx=60, pady=8) def on_start_click(): diff = difficulty.get() rows, cols = map(int, diff.split("x")) start_game(rows, cols) tk.Button(root, text="开始游戏", font=("Arial", 20), bg="lightgreen", command=on_start_click).pack(pady=30, ipadx=20, ipady=10) root.mainloop() # 程序入口 if __name__ == "__main__": show_start_window()