From 9aadcd7db309502e736c853c33434057328a92fe Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Thu, 20 Jul 2023 16:47:16 -0400 Subject: [PATCH] Use Size type, just for fun, in get_screen_size --- src/textual_paint/paint.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/textual_paint/paint.py b/src/textual_paint/paint.py index d080df4..901011b 100755 --- a/src/textual_paint/paint.py +++ b/src/textual_paint/paint.py @@ -3654,7 +3654,7 @@ Columns: {len(palette) // 2} # self.message_box(_("Paint"), _("Failed to set the wallpaper."), "ok", error=e) # Because this is running in a thread, we can't directly access the UI. self.call_from_thread(self.message_box, _("Paint"), _("Failed to set the wallpaper."), "ok", error=e) - def get_screen_size(self) -> tuple[int, int]: + def get_screen_size(self) -> Size: """Get the screen size.""" # TODO: test DPI scaling try: @@ -3668,7 +3668,7 @@ Columns: {len(palette) // 2} from Quartz import CGDisplayBounds, CGMainDisplayID main_monitor = CGDisplayBounds(CGMainDisplayID()) - return (int(main_monitor.size.width), int(main_monitor.size.height)) + return Size(int(main_monitor.size.width), int(main_monitor.size.height)) # from screeninfo import get_monitors # largest_area = 0 @@ -3684,12 +3684,12 @@ Columns: {len(palette) // 2} import tkinter root = tkinter.Tk() root.withdraw() - size = root.winfo_screenwidth(), root.winfo_screenheight() + size = Size(root.winfo_screenwidth(), root.winfo_screenheight()) root.destroy() return size except Exception as e: print("Failed to get screen size:", e) - return 1920, 1080 + return Size(1920, 1080) def action_recent_file(self) -> None: self.message_box(_("Paint"), "Not implemented.", "ok")