-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmain.py
More file actions
52 lines (41 loc) · 1.13 KB
/
main.py
File metadata and controls
52 lines (41 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
VideoSlim - A video compression application using x264
Refactored version: v1.8
"""
import logging
import tkinter as tk
from src.controller import Controller
from src.service import init_services
from src.view import View
def setup_logging():
"""
配置日志记录功能
该函数用于设置Python的日志记录系统,将日志信息写入到文件中。
配置包括日志级别、输出文件、文件写入模式以及日志格式。
"""
logging.basicConfig(
level=logging.DEBUG,
filename="log.txt",
filemode="w",
format="%(asctime)s - %(levelname)s - %(message)s",
encoding="utf-8",
)
def main():
"""
应用程序的主入口函数
该函数会:
1. 配置日志记录系统
2. 初始化所有服务(配置、消息、存储、更新)
3. 创建Tkinter根窗口
4. 初始化视图和控制器
5. 启动Tkinter主事件循环
"""
setup_logging()
init_services()
root = tk.Tk()
app = View(root, Controller())
root.mainloop()
if __name__ == "__main__":
main()