From bec569475df83ae1781e6ca897cbde1586abf6c1 Mon Sep 17 00:00:00 2001 From: "Egli Adrian (IT-SCI-API-PFI)" <adrian.egli@sbb.ch> Date: Tue, 2 Jul 2019 08:47:26 +0200 Subject: [PATCH] bug fix osx: screeninfo: don't plan on testing OSX or other environments myself. For this reason, I strongly encourage pull requests. --- flatland/utils/graphics_pil.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/flatland/utils/graphics_pil.py b/flatland/utils/graphics_pil.py index 5548d6f1..fbac4355 100644 --- a/flatland/utils/graphics_pil.py +++ b/flatland/utils/graphics_pil.py @@ -1,5 +1,6 @@ import io import os +import platform import time import tkinter as tk @@ -45,9 +46,14 @@ class PILGL(GraphicsLayer): if jupyter is False: self.screen_width = 99999 self.screen_height = 99999 - for m in get_monitors(): - self.screen_height = min(self.screen_height, m.height) - self.screen_width = min(self.screen_width, m.width) + + if platform.system() == "Windows" or platform.system() == "Linux": + for m in get_monitors(): + self.screen_height = min(self.screen_height, m.height) + self.screen_width = min(self.screen_width, m.width) + else: + self.screen_width = 800 + self.screen_height = 600 w = (self.screen_width - self.width - 10) / (self.width + 1 + self.linewidth) h = (self.screen_height - self.height - 10) / (self.height + 1 + self.linewidth) -- GitLab