do not show tk window on start(python) or exit(Ipython)

This commit is contained in:
Martin Diehl 2020-03-19 08:31:24 +01:00
parent d6f74daf53
commit b5899b51e1
1 changed files with 8 additions and 4 deletions

View File

@ -1,16 +1,20 @@
import os import os
try:
import tkinter
except:
tkinter = None
class Environment(): class Environment:
def __init__(self): def __init__(self):
"""Read and provide values of DAMASK configuration.""" """Read and provide values of DAMASK configuration."""
self.options = self._get_options() self.options = self._get_options()
try: if tkinter:
import tkinter
tk = tkinter.Tk() tk = tkinter.Tk()
self.screen_width = tk.winfo_screenwidth() self.screen_width = tk.winfo_screenwidth()
self.screen_height = tk.winfo_screenheight() self.screen_height = tk.winfo_screenheight()
except Exception: tk.destroy()
else:
self.screen_width = 1024 self.screen_width = 1024
self.screen_height = 768 self.screen_height = 768