-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_dpi.py
More file actions
75 lines (60 loc) · 2.35 KB
/
test_dpi.py
File metadata and controls
75 lines (60 loc) · 2.35 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python3
"""
Test DPI scaling fixes
"""
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
def test_dpi_fixes():
"""Test DPI awareness and geometry calculation"""
print("Testing DPI Scaling Fixes")
print("=" * 40)
try:
from utils.helpers import get_system_info
# Show system info
info = get_system_info()
print("📊 SYSTEM INFO:")
for key, value in info.items():
print(f" {key}: {value}")
print("\n🔧 DPI FIXES IMPLEMENTED:")
print(" • Windows DPI awareness (SetProcessDpiAwareness)")
print(" • Dynamic initial geometry calculation")
print(" • Real-time geometry verification and correction")
print(" • Proper window update after show()")
print("\n📋 EXPECTED BEHAVIOR:")
print(" • Consistent window size from first start")
print(" • No size change after first click")
print(" • Proper scaling on high-DPI displays")
print(" • Debug output shows geometry calculations")
# Test geometry calculation
print("\n🧮 TESTING GEOMETRY CALCULATION:")
import tkinter as tk
root = tk.Tk()
root.withdraw()
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
# Calculate initial size (same logic as overlay)
width = min(400, screen_width // 4)
height = min(300, screen_height // 4)
x = (screen_width - width) // 4
y = (screen_height - height) // 4
print(f" Screen: {screen_width}x{screen_height}")
print(f" Calculated overlay: {width}x{height}+{x}+{y}")
root.destroy()
return True
except Exception as e:
print(f"❌ DPI test failed: {e}")
return False
def main():
"""Run DPI tests"""
if test_dpi_fixes():
print("\n🎉 DPI fixes ready!")
print("The overlay window should now:")
print(" • Start with consistent size")
print(" • Maintain size after first click")
print(" • Scale properly on high-DPI displays")
print("\n🚀 Test with: python main.py")
else:
print("\n⚠️ Some DPI issues detected")
if __name__ == "__main__":
main()