py算命小程序-

不一定有用,来自吾爱破解https://www.52pojie.cn/thread-1947926-1-1.html

import tkinter as tk
from tkinter import ttk
from datetime import datetime
from tkinter import messagebox
import tkinter.filedialog as filedialog
import random
import time
import pickle
import os
 
# 将权重字典提取出来作为全局变量
YEAR_WEIGHTS = {
    "鼠": [1.2, 1.6, 1.5, 0.7, 0.5],
    "牛": [0.9, 0.8, 0.7, 0.7, 0.7],
    "虎": [0.6, 0.8, 0.9, 0.9, 1.2],
    "兔": [0.7, 1.9, 1.2, 1.2, 0.8],
    "龙": [1.2, 1.2, 1.0, 0.8, 0.8],
    "蛇": [0.5, 0.6, 0.7, 0.7, 0.6],
    "马": [0.9, 0.8, 1.5, 1.3, 1.9],
    "羊": [0.8, 0.7, 0.6, 0.5, 0.6],
    "猴": [0.7, 0.5, 0.5, 1.4, 0.8],
    "鸡": [0.8, 1.5, 1.4, 0.5, 1.6],
    "狗": [1.5, 0.6, 1.4, 0.9, 1.0],
    "猪": [0.9, 1.6, 0.9, 1.7, 0.6]
}
 
MONTH_WEIGHTS = {
    "正月": 0.6, "二月": 0.7, "三月": 1.8, "四月": 0.9, "五月": 0.5, "六月": 1.6,
    "七月": 0.9, "八月": 1.5, "九月": 1.8, "十月": 0.8, "十一月": 0.9, "十二月": 0.5
}
 
DAY_WEIGHTS = {
    "初一": 0.5, "初二": 1.0, "初三": 0.8, "初四": 1.5, "初五": 1.6, "初六": 1.5,
    "初七": 0.8, "初八": 1.6, "初九": 0.8, "初十": 1.6, "十一": 0.9, "十二": 1.7,
    "十三": 0.8, "十四": 1.7, "十五": 1.0, "十六": 0.8, "十七": 0.9, "十八": 1.8,
    "十九": 0.5, "二十": 1.5, "廿一": 1.0, "廿二": 0.9, "廿三": 0.8, "廿四": 0.9,
    "廿五": 1.5, "廿六": 1.8, "廿七": 0.7, "廿八": 0.8, "廿九": 1.6, "三十": 0.6
}
 
HOUR_WEIGHTS = {
    "子时(23:00-00:59)": 1.6, "丑时(01:00-02:59)": 0.6, "寅时(03:00-04:59)": 0.7,
    "卯时(05:00-06:59)": 1.0, "辰时(07:00-08:59)": 0.9, "巳时(09:00-10:59)": 1.6,
    "午时(11:00-12:59)": 1.0, "未时(13:00-14:59)": 0.8, "申时(15:00-16:59)": 0.8,
    "酉时(17:00-18:59)": 0.9, "戌时(19:00-20:59)": 0.6, "亥时(21:00-22:59)": 0.6
}
 
def load_results(filepath):
    results = {}
    with open(filepath, 'r', encoding='utf-8') as file:  # 尝试使用utf-8编码打开文件
        next(file)  # Skip the header line
        bones_weight, result = None, ''
        for line in file:
            parts = line.strip().split('\t')
            if len(parts) == 2:
                # 如果当前行可以被分割成两部分,那么它是一个新的记录
                if bones_weight is not None:
                    # 如果之前已经有一个记录,那么将它添加到结果中
                    results[bones_weight] = result
                bones_weight, result = parts
            else:
                # 如果当前行不能被分割成两部分,那么它是上一个记录的一部分
                result += '\n' + line.strip()
        if bones_weight is not None:
            # 将最后一个记录添加到结果中
            results[bones_weight] = result
    return results
 
# 定义一个列表来存储十二个属相
ZODIAC = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"]
 
def calculate_weight(year, month, day, hour):
    # 计算出生年份与基准年份的差值
    diff = int(year[:-1]) - 1924
 
    # 计算出生年份在60年循环中的位置
    position = diff % 60
 
    # 计算属相和天干
    zodiac = ZODIAC[position // 5]
    heavenly_stem = position % 10 // 2
 
    # 在字典中查找对应的骨重
    year_weight = YEAR_WEIGHTS[zodiac][heavenly_stem]
    month_weight = MONTH_WEIGHTS.get(month, 0)
    day_weight = DAY_WEIGHTS.get(day, 0)
    hour_weight = HOUR_WEIGHTS.get(hour, 0)
 
    total_weight = year_weight + month_weight + day_weight + hour_weight
    liang = int(total_weight)
    qian = int((total_weight - liang) * 10)
    return f"{liang}两{qian}钱"
 
def hide_error_message():
    error_label.config(text="")
 
def load_history():
    if os.path.exists('history.pkl'):
        with open('history.pkl', 'rb') as f:
            return pickle.load(f)
    else:
        return {}
 
def save_history(history):
    with open('history.pkl', 'wb') as f:
        pickle.dump(history, f)
 
def show_result(name, age, gender, weight, result):
    # 创建一个新的顶级窗口
    result_window = tk.Toplevel(root)
 
    # 设置窗口标题
    result_window.title("算命结果   *参考唐代玄学家袁天罡称骨算命法* ")
 
    # 创建一个Frame
    frame = tk.Frame(result_window)
    frame.pack(fill="both", expand=True)
 
    # 创建一个Text控件
    text = tk.Text(frame, font=("Microsoft Yahei", 12), wrap="word", padx=18, pady=12)  # 设置边距为18像素
    text.pack(side="left", fill="both", expand=True)
 
    # 创建一个Style对象
    style = ttk.Style()
 
    # 配置滚动条的样式
    style.configure("Vertical.TScrollbar", gripcount=0,
                    background="#C4C4C4", darkcolor="#C4C4C4", lightcolor="#C4C4C4",
                    troughcolor="#C4C4C4", bordercolor="#C4C4C4", arrowcolor="black", width=25 )
 
    # 创建一个滚动条,并应用样式
    scrollbar = ttk.Scrollbar(frame, style="Vertical.TScrollbar")
    scrollbar.pack(side="right", fill="y")
 
    # 将滚动条和Text控件关联起来
    text.config(yscrollcommand=scrollbar.set)
    scrollbar.config(command=text.yview)
 
    # 根据性别选择对应的结果
    if "男命" in result and "女命" in result:
        if gender == "男":
            result = result.split("女命")[0]
        else:
            result = result.split("女命")[1]
 
    # 插入文本
    text.insert("end", f"姓名:{name}\n", "bold")
    text.insert("end", f"年龄:{age}\n", "bold")
    text.insert("end", f"性别:{gender}\n", "bold")
    text.insert("end", f"骨重:{weight}\n\n", "bold")
    text.insert("end", result)
 
    # 设置标签样式
    text.tag_config("bold", foreground="blue", font=("Microsoft Yahei", 13, "bold"))
         
    # 禁止用户编辑文本
    text.config(state="disabled")
 
    # 更新窗口的大小
    result_window.update_idletasks()
 
    # 获取主窗口的位置和大小
    window_info = root.geometry().split('+')
    root_x = int(window_info[1])
    root_y = int(window_info[2])
    root_width = root.winfo_width()
    root_height = root.winfo_height()
 
    # 计算新窗口的位置
    result_window_x = root_x + (root_width - result_window.winfo_width()) // 2
    result_window_y = root_y + (root_height - result_window.winfo_height()) // 2
 
    # 设置新窗口的位置
    result_window.geometry(f"+{result_window_x}+{result_window_y}")
 
    # 创建一个菜单栏
    menubar = tk.Menu(result_window)
    result_window.config(menu=menubar)
 
    def export_result():
        file_path = filedialog.asksaveasfilename(defaultextension="result.txt", filetypes=[("文本文件", "*.txt")])
        if file_path:
            with open(file_path, "w", encoding="utf-8") as f:
                # 导出更多信息
                f.write(text.get("1.0", "end"))
            messagebox.showinfo("提示", "导出成功!")
 
    # 创建一个Frame用于放置姓名、年龄等信息和导出按钮
    info_frame = tk.Frame(result_window)
    info_frame.pack(fill="x", padx=18, pady=12)
 
    # 创建导出按钮
    export_button = ttk.Button(info_frame, text="导出结果", command=export_result)
    export_button.pack(side="right")
 
    # 插入姓名、年龄等信息
    info_label = tk.Label(info_frame, text="“本软件算命结果仅供娱乐参考,请勿过于迷信,人生仍需自身努力。”", font=("Microsoft Yahei", 12,"bold"))
    info_label.pack(side="left")
 
    # 设置新窗口的位置
    result_window.geometry(f"+{result_window_x}+{result_window_y}")
 
 
def get_info(event=None):
    name = entry_name.get()
    year = year_var.get()
    month = month_var.get()
    day = day_var.get()
    hour = hour_var.get()
    gender = gender_var.get()
 
    if not name:
        error_label.config(text="请输入姓名")
        root.after(2000, hide_error_message)
        return
 
    if year == "选择年份" or month == "选择月份" or day == "选择日期" or hour == "选择时辰" or gender == "选择性别":
        error_label.config(text="请完整填写所有信息")
        root.after(2000, hide_error_message)
        return
 
    # 获取当前脚本所在的目录
    script_dir = os.path.dirname(os.path.abspath(__file__))
 
    # 构建 ming.txt 文件的相对路径
    relative_path = "ming.txt"
    file_path = os.path.join(script_dir, relative_path)
 
    # 在结果标签和错误标签之间添加一个进度条
    progress_var = tk.DoubleVar()  # 进度条的值
    progress_bar = ttk.Progressbar(root, variable=progress_var, length=400)
    progress_bar.grid(row=8, column=0, columnspan=2, padx=5, pady=5)
 
    # 显示进度条
    progress_bar.grid()
    result_label.config(text="分析中...", fg="green")
    weight = calculate_weight(year[:-1], month, day, hour)
    results = load_results(file_path)
    result = results.get(weight, "未找到对应的算命结果")
 
    # 模拟一个耗时的操作,更新进度条的值
    progress = 0
    while progress < 100:
        increment = random.randint(1, 24)  # 随机生成进度增量
        progress += increment
        if progress > 100:
            progress = 100
        progress_var.set(progress)  # 更新进度条的值
        root.update_idletasks()  # 强制更新界面
        time.sleep(0.6)  # 暂停0.1秒
 
    # 隐藏进度条
    progress_bar.grid_remove()
 
    # 计算年龄
    birth_year = int(year[:-1])
    current_year = datetime.now().year
    age = current_year - birth_year
 
    show_result(name, age, gender, weight, result)
    result_label.config(text="算命完成!", fg="green")
    root.after(2500, lambda: result_label.config(text=""))  # 2.5秒后清空结果标签
 
    # 保存历史记录
    history = load_history()
    history[name] = (gender, year, month, day, hour)
    save_history(history)
 
if __name__ == "__main__":
    root = tk.Tk()
    root.title("李氏算命 V1.1")
 
    # 设置窗口的大小和位置
    width = 500  # 窗口的宽度
    height = 440  # 窗口的高度,使得长宽比为5:4
    screen_width = root.winfo_screenwidth()  # 屏幕的宽度
    screen_height = root.winfo_screenheight()  # 屏幕的高度
    x = (screen_width - width) // 2  # 窗口的横坐标,使得窗口在屏幕中居中
    y = (screen_height - height) // 2  # 窗口的纵坐标,使得窗口在屏幕中居中
    root.geometry(f"{width}x{height}+{x}+{y}")  # 设置窗口的大小和位置
 
    # 设置字体大小和样式
    font = ("Microsoft Yahei", 14)
 
    style = ttk.Style()
    style.configure("TCombobox", fieldbackground="white", background="white", arrowcolor="black", selectbackground="#3399fe", selectforeground="white")
 
    def on_name_changed(*args):
        name = name_var.get()
        history = load_history()
        if name in history:
            gender, year, month, day, hour = history[name]
            gender_var.set(gender)
            year_var.set(year)
            month_var.set(month)
            day_var.set(day)
            hour_var.set(hour)
 
    label_name = tk.Label(root, text="姓      名:", font=font)
    label_name.grid(row=0, column=0, padx=5, pady=5, sticky='ew')
 
    name_var = tk.StringVar(root)
    name_var.trace('w', on_name_changed)
    entry_name = ttk.Entry(root, textvariable=name_var, width=20, font=font)
    entry_name.grid(row=0, column=1, padx=5, pady=5, sticky='ew')
 
    # 定义一个字典来存储每个年份对应的闰月
    LEAP_MONTHS = {
        1903: "闰五月", 1906: "闰四月", 1909: "闰二月", 1911: "闰六月", 1914: "闰五月", 1917: "闰二月", 1919: "闰七月",
        1922: "闰五月", 1925: "闰四月", 1928: "闰二月", 1930: "闰六月", 1933: "闰五月", 1936: "闰三月", 1938: "闰七月",
        1941: "闰六月", 1944: "闰四月", 1947: "闰二月", 1949: "闰七月", 1952: "闰五月", 1955: "闰三月", 1957: "闰八月",
        1960: "闰六月", 1963: "闰四月", 1966: "闰三月", 1968: "闰七月", 1971: "闰五月", 1974: "闰四月", 1976: "闰八月",
        1979: "闰六月", 1982: "闰四月", 1984: "闰十月", 1987: "闰六月", 1990: "闰五月", 1993: "闰三月", 1995: "闰八月",
        1998: "闰五月", 2001: "闰四月", 2004: "闰二月", 2006: "闰七月", 2009: "闰五月", 2012: "闰四月", 2014: "闰九月",
        2017: "闰六月", 2020: "闰四月", 2023: "闰二月", 2025: "闰六月", 2028: "闰五月", 2031: "闰三月", 2033: "闰十一月",
        2036: "闰六月", 2039: "闰五月", 2042: "闰二月", 2044: "闰七月", 2047: "闰五月", 2050: "闰三月", 2052: "闰八月",
        2055: "闰六月", 2058: "闰四月", 2061: "闰三月", 2063: "闰七月", 2066: "闰五月", 2069: "闰四月", 2071: "闰八月",
        2074: "闰六月", 2077: "闰四月", 2080: "闰三月", 2082: "闰七月", 2085: "闰五月", 2088: "闰四月", 2090: "闰八月",
        2093: "闰六月", 2096: "闰四月", 2099: "闰二月"
    }
 
    # 定义年份变量
    year_var = tk.StringVar(root)
 
    # 更新月份选项的函数
    def update_month_options(*args):
        year = year_var.get()
        if year.endswith("年"):
            year = int(year[:-1])
            months = ["正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
            if year in LEAP_MONTHS:
                leap_month = LEAP_MONTHS[year]
                # 找到闰月对应的月份,并插入闰月
                for i, month in enumerate(months):
                    if leap_month.endswith(month):
                        months.insert(i + 1, leap_month)
                        break
            month_combobox['values'] = months
 
    # 绑定年份选择事件
    year_var.trace('w', update_month_options)
 
    # 在其他输入框下面添加一个新的输入框
    label_gender = tk.Label(root, text="性      别:", font=font)
    label_gender.grid(row=1, column=0, padx=5, pady=5, sticky='ew')
 
    gender_var = tk.StringVar(root)
    gender_combobox = ttk.Combobox(root, textvariable=gender_var, values=["男", "女"], state="readonly", width=18, font=font)
    gender_combobox.set("选择性别")
    gender_combobox.grid(row=1, column=1, padx=5, pady=5, sticky='ew')
 
    # 更新月份选项
    update_month_options()
 
    label_year = tk.Label(root, text="出生年份:", font=font)
    label_year.grid(row=2, column=0, padx=5, pady=5, sticky='ew')
 
    year_combobox = ttk.Combobox(root, textvariable=year_var, values=[f"{i}年" for i in range(2027, 1939, -1)], state="readonly", width=18, font=font)
    year_combobox.set("选择年份")
    year_combobox.grid(row=2, column=1, padx=5, pady=5, sticky='ew')
 
    label_month = tk.Label(root, text="出生月份:", font=font)
    label_month.grid(row=3, column=0, padx=5, pady=5, sticky='ew')
 
    month_var = tk.StringVar(root)
    month_combobox = ttk.Combobox(root, textvariable=month_var, values=["正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], state="readonly", width=18, font=font)
    month_combobox.set("选择月份")
    month_combobox.grid(row=3, column=1, padx=5, pady=5, sticky='ew')
 
    label_day = tk.Label(root, text="出生日期:", font=font)
    label_day.grid(row=4, column=0, padx=5, pady=5, sticky='ew')
 
    month_var = tk.StringVar(root)
    month_combobox = ttk.Combobox(root, textvariable=month_var, values=["正月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], state="readonly", width=18, font=font)
    month_combobox.set("选择月份")
    month_combobox.grid(row=3, column=1, padx=5, pady=5, sticky='ew')
 
    label_day = tk.Label(root, text="出生日期:", font=font)
    label_day.grid(row=4, column=0, padx=5, pady=5, sticky='ew')
 
    day_var = tk.StringVar(root)
    day_combobox = ttk.Combobox(root, textvariable=day_var, values=["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十"], state="readonly", width=18, font=font)
    day_combobox.set("选择日期")
    day_combobox.grid(row=4, column=1, padx=5, pady=5, sticky='ew')
 
    label_hour = tk.Label(root, text="具体时间:", font=font)
    label_hour.grid(row=5, column=0, padx=5, pady=5, sticky='ew')
 
    hour_var = tk.StringVar(root)
    hour_combobox = ttk.Combobox(root, textvariable=hour_var, values=["子时(23:00-00:59)", "丑时(01:00-02:59)", "寅时(03:00-04:59)", "卯时(05:00-06:59)", "辰时(07:00-08:59)", "巳时(09:00-10:59)", "午时(11:00-12:59)", "未时(13:00-14:59)", "申时(15:00-16:59)", "酉时(17:00-18:59)", "戌时(19:00-20:59)", "亥时(21:00-22:59)"], state="readonly", width=18, font=font)
    hour_combobox.set("选择时辰")
    hour_combobox.grid(row=5, column=1, padx=5, pady=5, sticky='ew')
 
    # 创建一个Frame作为按钮的容器,设置背景颜色为蓝色
    button_frame = tk.Frame(root, bg="black")
    button_frame.grid(row=6, column=0, columnspan=2, padx=5, pady=5, sticky='ew')
 
    # 创建一个按钮,设置背景颜色为白色,放入Frame中
    button_submit = tk.Button(button_frame, text="开始算命", command=get_info, font=("Microsoft Yahei", 14), bg="white", width=140)
    button_submit.pack(padx=1.5, pady=1.5)  # 设置边框宽度为2像素
 
    notice_label = tk.Label(root, text="*注意:出生日期为农历", fg="red", font=font)
    notice_label.grid(row=7, column=0, columnspan=2, padx=5, pady=5, sticky='ew')
 
    root.bind('<Return>', get_info)
 
    # 将结果标签放置在第8行
    result_label = tk.Label(root, text="", wraplength=400, font=font)
    result_label.grid(row=8, column=0, columnspan=2, padx=5, pady=5, sticky='ew')
 
    # 将错误标签放置在第9行
    error_label = tk.Label(root, text="", fg="red", font=font)
    error_label.grid(row=9, column=0, columnspan=2, padx=5, pady=5, sticky='ew')
 
    # 使用sticky选项将标签框架填充满整个单元格
    root.grid_rowconfigure(8, weight=1)
    root.grid_rowconfigure(9, weight=1)  # 添加这一行以确保错误标签也可以填充满单元格
    root.grid_columnconfigure(0, weight=1)
    root.grid_columnconfigure(1, weight=1)
 
    def show_version_info():
        # 创建一个新的顶级窗口
        version_window = tk.Toplevel(root)
 
        # 设置窗口标题
        version_window.title("更多信息")
 
        # 设置窗口的大小
        version_window.geometry("380x320")
 
        # 创建一个Notebook控件
        notebook = ttk.Notebook(version_window)
        notebook.pack(fill="both", expand=True)
 
        # 创建几个Frame控件作为选项卡的内容
        frame1 = tk.Frame(notebook)
        frame2 = tk.Frame(notebook)
        frame3 = tk.Frame(notebook)
        frame4 = tk.Frame(notebook)
        frame5 = tk.Frame(notebook)
 
        # 将Frame控件添加到Notebook控件中
        notebook.add(frame1, text="算命说明")
        notebook.add(frame2, text="称骨算命")
        notebook.add(frame3, text="运行需求")
        notebook.add(frame4, text="了解帮助")
        notebook.add(frame5, text="反馈提交")
 
        # 在每个Frame控件中添加一些内容,并设置anchor和side选项
        tk.Label(frame1, text="称骨算命是一种传统文化中的算命方式,其科学性存疑。使用该程序进行算命仅供娱乐参考,请勿过于迷信。", font=("KaiTi", 13), wraplength=350).pack(ipadx=100,ipady=60)
        tk.Label(frame2, text="称骨算命是由袁天罡创立,根据每个人的生辰八字,年、月、日、时分别的重量计算总合。得出八字重量:称骨重量。然后根据袁天罡称骨算法进行称骨算命。\n 1两=10钱,每一个重量都有详细分析算命结果。", font=("KaiTi", 13), wraplength=350).pack(ipadx=100,ipady=60)
        tk.Label(frame3, text="建议使用 Windows 10 及以上版本系统", font=("KaiTi", 13, "bold"), wraplength=350).pack(ipadx=100,ipady=60)
        tk.Label(frame5, text="如果您有任何问题或建议,欢迎在本帖子下回复或评分。\nhttps://www.52pojie.cn/", font=("KaiTi", 13), wraplength=350).pack(ipadx=10,ipady=10)
 
        # 更新窗口的大小
        version_window.update_idletasks()
 
        # 获取主窗口的位置和大小
        window_info = root.geometry().split('+')
        root_x = int(window_info[1])
        root_y = int(window_info[2])
        root_width = root.winfo_width()
        root_height = root.winfo_height()
 
        # 计算新窗口的位置
        version_window_x = root_x + (root_width - version_window.winfo_width()) // 2
        version_window_y = root_y + (root_height - version_window.winfo_height()) // 2
 
        # 设置新窗口的位置
        version_window.geometry(f"+{version_window_x}+{version_window_y}")
 
        import webbrowser
 
        def open_link_baidu(event):
            webbrowser.open_new(r"https://www.52pojie.cn/")
 
        def open_link_ref(event):
            webbrowser.open_new(r"https://www.52pojie.cn/home.php?mod=follow&uid=2260954")
 
        # 在frame4中添加一些内容
        tk.Label(frame4, text="如果想了解后续更新信息,请点击查看:  吾爱破解:", wraplength=245).pack(ipadx=10,ipady=10)
 
        # 创建一个Text控件
        text_widget_baidu = tk.Text(frame4, height=1, wrap="none")  # height=1表示只显示一行文本
        text_widget_baidu.insert("1.0", "https://www.52pojie.cn/")
        text_widget_baidu.tag_add("link", "1.0", "end")
        text_widget_baidu.tag_config("link", foreground="blue", underline=True)
        text_widget_baidu.tag_bind("link", "<Button-1>", open_link_baidu)
        text_widget_baidu.configure(state="disabled")  # 设置为只读模式
        text_widget_baidu.pack(ipadx=10, ipady=10)
 
        tk.Label(frame4, text="个人主页:").pack(ipadx=10,ipady=10)
 
        # 创建一个Text控件
        text_widget_ref = tk.Text(frame4, height=1, wrap="none")  # height=1表示只显示一行文本
        text_widget_ref.insert("1.0", "https://www.52pojie.cn/home.php?mod=follow&uid=2260954")
        text_widget_ref.tag_add("link", "1.0", "end")
        text_widget_ref.tag_config("link", foreground="blue", underline=True)
        text_widget_ref.tag_bind("link", "<Button-1>", open_link_ref)
        text_widget_ref.configure(state="disabled")  # 设置为只读模式
        text_widget_ref.pack(ipadx=10, ipady=10)
 
    # 显示关于信息的函数
    def show_version1_info():
        version_text = (
            "李氏算命 V1.1\n\n"
            "原创作者: LjhaiDj\n"
            "最近更新:2024年8月1日\n\n"
            "Copyright &#169; 2024 LjhaiDj(吾爱破解). All rights reserved. "
        )
        messagebox.showinfo("关于李氏算命", version_text)
 
    # 显示软件声明信息的函数
    def show_declaration():
        declaration_text = (
            "软件声明:\n"
            "信息参考网上资源以及AI生成,请注意分辨。\n"
            "特别注意: 称骨算命是一种传统文化中的算命方式,其科学性存疑。使用该程序进行算命仅供娱乐参考,请勿过于迷信。\n"
            "如果您有任何问题,请联系开发者。"
        )
        messagebox.showinfo("声明", declaration_text)
 
    # 显示隐私声明信息的函数
    def show_declaration_pra():
        declaration_text = (
            "隐私声明:\n"
            "本软件不会收集您的任何个人信息,请放心输入。\n"
            "本软件不会要求获取设备隐私权限。\n"
            "本程序算命结果仅供参考!"
        )
        messagebox.showinfo("声明", declaration_text)
 
    # 显示权限声明信息的函数
    def show_declaration_power():
        declaration_text = (
            "权限声明:\n"
            "本程序着重在于学习,不要使用本程序做违法乱纪坑蒙拐骗的行为!\n"
            "禁止商用,违者必究!\n"
            "如果转载,请注明出处!谢谢!"
        )
        messagebox.showinfo("声明", declaration_text)
 
    # 显示更新内容的函数
    def show_update_info():
        declaration_text = (
            "最近更新:2024年8月1日\n"
            "软件版本: 李氏算命 V1.1\n"
            "更新内容:\n"
            "1. 更新算法,修复无算命结果错误\n"
            "2. 增加性别选项,结果更清晰\n"
            "3. 补充闰月选项,丰富算命结果\n"
            "4. 添加导出功能,导出算命结果\n"
        "—————————————————————————————\n"
        "后续更新考虑使用新的架构、现代UI和新的算法,并加入更多更专业的内容(八字五行摆盘、星座、婚配、运势等)\n"
        "请大家持续关注,谢谢。"
        )
        messagebox.showinfo("更新内容", declaration_text)
 
    # 创建一个菜单栏
    menu_bar = tk.Menu(root)
    root.config(menu=menu_bar)
 
    # 创建“更新信息”菜单
    help_menu = tk.Menu(menu_bar, tearoff=0)
    menu_bar.add_cascade(label="更新信息", menu=help_menu)
    help_menu.add_command(label="软件版本", command=show_version1_info)
    help_menu.add_command(label="更新内容", command=show_update_info)
 
    # 创建“声明”菜单
    help_menu = tk.Menu(menu_bar, tearoff=0)
    menu_bar.add_cascade(label="声明", menu=help_menu)
    help_menu.add_command(label="软件声明", command=show_declaration)
    help_menu.add_command(label="隐私声明", command=show_declaration_pra)
    help_menu.add_command(label="权限声明", command=show_declaration_power)
 
    # 创建“帮助”菜单
    help_menu = tk.Menu(menu_bar, tearoff=0)
    menu_bar.add_cascade(label="帮助", menu=help_menu)
    help_menu.add_command(label="关于", command=show_version1_info)
    help_menu.add_command(label="更多", command=show_version_info)
 
    # 创建“语言”菜单
    help_menu = tk.Menu(menu_bar, tearoff=0)
    menu_bar.add_cascade(label="语言", menu=help_menu)
    help_menu.add_command(label="中文(简体)")
    help_menu.add_command(label="Chinese (Simplified)")
    help_menu.add_command(label="&#51473;&#44397;&#50612; (&#44036;&#52404;)")
    help_menu.add_command(label="Vereinfachtes Chinesisch")
    help_menu.add_command(label="&#1575;&#1604;&#1589;&#1610;&#1606;&#1610;&#1577; &#1575;&#1604;&#1605;&#1576;&#1587;&#1591;&#1577;")
    help_menu.add_command(label="......")
 
    root.mainloop()

 

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注