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