Merge branch 'fix_tkinter_import' into 'master'

[python] Import tkinter only when necessary

See merge request !69
This commit is contained in:
Joachim Schöberl 2017-11-06 16:11:05 +01:00
commit b405528b37
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
if(USE_GUI)
set(IMPORT_TKINTER True)
else()
set(IMPORT_TKINTER False)
endif()
configure_file(__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)
install(FILES

View File

@ -1,6 +1,8 @@
import os
import sys
# import tkinter only if Netgen was configured with USE_GUI=ON
if @IMPORT_TKINTER@:
import tkinter
_netgen_bin_dir=os.path.realpath(os.path.join(os.path.dirname(__file__),'..','@NETGEN_PYTHON_RPATH_BIN@'))