From b5899b51e1d72e561174719112fb28ed9558fd83 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 19 Mar 2020 08:31:24 +0100 Subject: [PATCH] do not show tk window on start(python) or exit(Ipython) --- python/damask/environment.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/python/damask/environment.py b/python/damask/environment.py index a4e4ed7b3..6ce020406 100644 --- a/python/damask/environment.py +++ b/python/damask/environment.py @@ -1,16 +1,20 @@ import os +try: + import tkinter +except: + tkinter = None -class Environment(): +class Environment: def __init__(self): """Read and provide values of DAMASK configuration.""" self.options = self._get_options() - try: - import tkinter + if tkinter: tk = tkinter.Tk() self.screen_width = tk.winfo_screenwidth() self.screen_height = tk.winfo_screenheight() - except Exception: + tk.destroy() + else: self.screen_width = 1024 self.screen_height = 768