Compare commits
3 Commits
v1.1
...
36bf0fcf33
Author | SHA1 | Date | |
---|---|---|---|
36bf0fcf33
|
|||
44fd986f6c
|
|||
69f320ec2d
|
65
auto-py-to-exe.json
Normal file
65
auto-py-to-exe.json
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
"version": "auto-py-to-exe-configuration_v1",
|
||||||
|
"pyinstallerOptions": [
|
||||||
|
{
|
||||||
|
"optionDest": "noconfirm",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "filenames",
|
||||||
|
"value": "J:/Projects/LuckyDraw/main.py"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "onefile",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "console",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "icon_file",
|
||||||
|
"value": "J:/Projects/LuckyDraw/icon.ico"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "clean_build",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "strip",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "noupx",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "disable_windowed_traceback",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "uac_admin",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "uac_uiaccess",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "argv_emulation",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "bootloader_ignore_signals",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"optionDest": "datas",
|
||||||
|
"value": "J:/Projects/LuckyDraw/icon.png;."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nonPyinstallerOptions": {
|
||||||
|
"increaseRecursionLimit": true,
|
||||||
|
"manualArguments": ""
|
||||||
|
}
|
||||||
|
}
|
14
main.py
14
main.py
@ -4,6 +4,8 @@ import random
|
|||||||
import winreg
|
import winreg
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import os
|
import os
|
||||||
|
import pkg_resources
|
||||||
|
import base64
|
||||||
|
|
||||||
# 注册表路径
|
# 注册表路径
|
||||||
REGISTRY_PATH = r"Software\StudentIDDraw"
|
REGISTRY_PATH = r"Software\StudentIDDraw"
|
||||||
@ -274,7 +276,7 @@ def open_settings():
|
|||||||
)
|
)
|
||||||
|
|
||||||
def save_changes():
|
def save_changes():
|
||||||
entered_password = simpledialog.askstring("密码", "请输入密码:", show="*")
|
entered_password = simpledialog.askstring("密码", "请输入密码:", parent=settings_window, show="*")
|
||||||
if entered_password == PASSWORD:
|
if entered_password == PASSWORD:
|
||||||
save_settings(
|
save_settings(
|
||||||
allow_repeat_var.get(), int(min_id_var.get()), int(max_id_var.get())
|
allow_repeat_var.get(), int(min_id_var.get()), int(max_id_var.get())
|
||||||
@ -284,6 +286,7 @@ def open_settings():
|
|||||||
close_settings_window()
|
close_settings_window()
|
||||||
else:
|
else:
|
||||||
messagebox.showerror("错误", "密码错误")
|
messagebox.showerror("错误", "密码错误")
|
||||||
|
settings_window.focus_force()
|
||||||
|
|
||||||
tk.Button(settings_window, text="保存", font=("宋体", 10), command=save_changes).grid(
|
tk.Button(settings_window, text="保存", font=("宋体", 10), command=save_changes).grid(
|
||||||
row=8, column=0, columnspan=2, padx=5, pady=20, sticky="ew"
|
row=8, column=0, columnspan=2, padx=5, pady=20, sticky="ew"
|
||||||
@ -305,18 +308,23 @@ def close_settings_window():
|
|||||||
settings_window.destroy()
|
settings_window.destroy()
|
||||||
settings_window = None
|
settings_window = None
|
||||||
|
|
||||||
|
def get_icon_data():
|
||||||
|
icon_path = pkg_resources.resource_filename(__name__, 'icon.png')
|
||||||
|
with open(icon_path, 'rb') as icon_file:
|
||||||
|
return base64.b64encode(icon_file.read())
|
||||||
|
|
||||||
# 初始化全局变量
|
# 初始化全局变量
|
||||||
selected_ids = load_selected_ids()
|
selected_ids = load_selected_ids()
|
||||||
settings_window = None
|
settings_window = None
|
||||||
history_list = None
|
history_list = None
|
||||||
|
|
||||||
|
icon_data = get_icon_data()
|
||||||
|
|
||||||
# 创建主窗口
|
# 创建主窗口
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
root.title("随机抽号机")
|
root.title("随机抽号机")
|
||||||
root.attributes("-topmost", 1)
|
root.attributes("-topmost", 1)
|
||||||
icon_path = os.path.join("icon.png")
|
icon_image = tk.PhotoImage(data=icon_data)
|
||||||
icon_image = tk.PhotoImage(file=icon_path)
|
|
||||||
root.iconphoto(True, icon_image)
|
root.iconphoto(True, icon_image)
|
||||||
|
|
||||||
# 创建标签,用于显示抽取的学号
|
# 创建标签,用于显示抽取的学号
|
||||||
|
Reference in New Issue
Block a user