xzhiwen 2026-03-26 08:19:21 +08:00
parent 8eee0c8c8d
commit f34d33e020
1 changed files with 4 additions and 2 deletions

6
0.py
View File

@ -114,14 +114,16 @@ class Api:
# ... 已有代码 ...
run_path = os.path.dirname(os.path.realpath(sys.argv[0]))
if __name__ == '__main__':
# ... 已有代码 ...
api = Api()
window_html = os.path.join(run_path, 'index', 'live-management.html')
# 在 create_window 中设置 api 对象,以便 JS 访问
window = webview.create_window('直播管理系统', window_html, js_api=api, min_size=(800, 600))
window = webview.create_window('直播管理系统', window_html, js_api=api, min_size=(1200, 800))
# 启动 webview。启动后界面将显示。
# live-management.html 中的 JS 代码应在 DOM 准备就绪且 pywebview api 可用后调用 get_initial_accounts()
webview.start(debug=True)
webview.start(debug=False)