all dp instead

This commit is contained in:
Sander Land committed 2020-06-03 20:04:20 +02:00
1 parent ede6ee67e0
commit 9405bd0eae
2 files changed
+6 -8

No files matched your search

+3 -5
View File
@@ -1,8 +1,5 @@
# first, logging level lower
import os
from kivy.metrics import dp
os.environ["KCFG_KIVY_LOG_LEVEL"] = os.environ.get("KCFG_KIVY_LOG_LEVEL", "warning")
# next, icon
@@ -12,12 +9,13 @@ ICON = find_package_resource("katrain/img/icon.ico") # isort:skip # find icon
Config.set("kivy", "window_icon", ICON) # isort:skip # set icon
# finally, window size
WINDOW_X, WINDOW_Y = 1300, 1000
from kivy.metrics import dp
WINDOW_X, WINDOW_Y = dp(1300), dp(1000)
try:
from screeninfo import get_monitors
scale = 1.0
for m in get_monitors():
scale = min(scale, (m.height-100) / WINDOW_Y, (m.width-100) / WINDOW_X)
scale = min(scale, (m.height-dp(100)) / WINDOW_Y, (m.width-dp(100)) / WINDOW_X)
WINDOW_SCALE_FAC = max(0.4,scale)
except Exception as e:
print("Exception while getting screen resolution", e)