try wxPython before tkinter, recent macOS otherwise fails

This commit is contained in:
Philip Eisenlohr 2020-06-29 21:50:33 -04:00
parent 2d0c680daf
commit 97ca1b1a9b
1 changed files with 14 additions and 8 deletions

View File

@ -1,19 +1,25 @@
import os
from pathlib import Path
import tkinter
class Environment:
def __init__(self):
"""Read and provide values of DAMASK configuration."""
self.screen_width = 1024
self.screen_height = 768
try:
import wx
app = wx.App(False)
self.screenwidth, self.screenheight = wx.GetDisplaySize()
except ImportError:
try:
import tkinter
tk = tkinter.Tk()
self.screen_width = tk.winfo_screenwidth()
self.screen_height = tk.winfo_screenheight()
tk.destroy()
except tkinter.TclError:
self.screen_width = 1024
self.screen_height = 768
except:
pass
@property
def options(self):