INNER CODE UNIT · Python
MixTeXApp
RQLuo/MixTeX-Latex-OCR · mixtexgui/mixtex_ui.py:25
class MixTeXApp:
def __init__(self, root):
self.root = root
# 添加 DPI 感知支持 (解决高分屏模糊问题)
try:
ctypes.windll.shcore.SetProcessDpiAwareness(1) # 启用 DPI 感知
self.dpi_scale = ctypes.windll.shcore.GetScaleFactorForDevice(0) / 100
self.root.tk.call('tk', 'scaling', self.dpi_scale)
except Exception as e:
print(f"DPI 设置失败: {e}")
self.dpi_scale = 1.0
self.root.title('MixTeX')
self.root.resizable(False, False)
self.root.overrideredirect(True)
self.root.wm_attributes('-topmost', 1)
self.root.attributes('-alpha', 0.85)