From 81c1d46db03c9e3d94a91d0a0244f1fac1304d71 Mon Sep 17 00:00:00 2001 From: "mhochsteger@cerbsim.com" Date: Tue, 9 Nov 2021 09:15:55 +0100 Subject: [PATCH] fix python import of non-gui builds --- python/__init__.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/python/__init__.py b/python/__init__.py index 424fc6e7..ac8f7ba6 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -16,17 +16,19 @@ del os from . import libngpy -_Redraw = libngpy.meshvis._Redraw +if config.USE_GUI: + global _Redraw, Redraw + _Redraw = libngpy.meshvis._Redraw -def RedrawWithEventHandling(*args, **kwargs): - try: - if libngpy.meshvis._Redraw(*args, **kwargs): - import netgen - import tkinter - cnt = 0 - while(netgen.gui.win.tk.dooneevent(tkinter._tkinter.DONT_WAIT) and cnt < 100): - cnt += 1 - except: - pass + def RedrawWithEventHandling(*args, **kwargs): + try: + if libngpy.meshvis._Redraw(*args, **kwargs): + import netgen + import tkinter + cnt = 0 + while(netgen.gui.win.tk.dooneevent(tkinter._tkinter.DONT_WAIT) and cnt < 100): + cnt += 1 + except: + pass -Redraw = RedrawWithEventHandling + Redraw = RedrawWithEventHandling