no tk event handling when starting netgen.__main__

This commit is contained in:
mhochsteger@cerbsim.com 2021-11-04 13:02:35 +01:00
parent 0d4028ea7a
commit 543d1a378a
2 changed files with 11 additions and 2 deletions

View File

@ -16,7 +16,9 @@ del os
from . import libngpy from . import libngpy
def Redraw(*args, **kwargs): from .libngpy.meshvis import _Redraw
def RedrawWithEventHandling(*args, **kwargs):
try: try:
if libngpy.meshvis._Redraw(*args, **kwargs): if libngpy.meshvis._Redraw(*args, **kwargs):
import netgen import netgen
@ -27,4 +29,4 @@ def Redraw(*args, **kwargs):
except: except:
pass pass
Redraw = RedrawWithEventHandling

View File

@ -8,6 +8,10 @@ def handle_arguments():
imp.load_module('__main__', pyfile, argv[1], (".py", "r", imp.PY_SOURCE)) imp.load_module('__main__', pyfile, argv[1], (".py", "r", imp.PY_SOURCE))
def main(): def main():
import netgen
# Use Redraw without event handling
netgen.Redraw = netgen._Redraw
try: try:
import ngsolve import ngsolve
except: except:
@ -16,3 +20,6 @@ def main():
th = threading.Thread(target=handle_arguments) th = threading.Thread(target=handle_arguments)
th.start() th.start()
win.tk.mainloop() win.tk.mainloop()
if __name__ == "__main__":
sys.exit(main())