mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Start GUI from Python only if Netgen exe is not running
This commit is contained in:
parent
b4f3107fef
commit
9a7307fb39
@ -13,6 +13,7 @@ using namespace netgen;
|
||||
|
||||
namespace netgen
|
||||
{
|
||||
extern bool netgen_executable_started;
|
||||
extern shared_ptr<NetgenGeometry> ng_geometry;
|
||||
}
|
||||
|
||||
@ -49,6 +50,8 @@ static Transformation<3> global_trafo(Vec<3> (0,0,0));
|
||||
|
||||
DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
{
|
||||
m.attr("_netgen_executable_started") = py::cast(netgen::netgen_executable_started);
|
||||
|
||||
py::class_<NGDummyArgument>(m, "NGDummyArgument")
|
||||
.def("__bool__", []( NGDummyArgument &self ) { return false; } )
|
||||
;
|
||||
|
@ -1,11 +1,16 @@
|
||||
from tkinter import Tk
|
||||
import netgen
|
||||
|
||||
from . import _netgen_lib_dir
|
||||
from . import _netgen_bin_dir
|
||||
def StartGUI():
|
||||
import os
|
||||
from tkinter import Tk
|
||||
|
||||
win = Tk()
|
||||
import os
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
win.tk.eval("source "+os.path.realpath(os.path.join(_netgen_bin_dir, 'ng.tcl')).replace('\\','/'))
|
||||
from . import _netgen_lib_dir
|
||||
from . import _netgen_bin_dir
|
||||
|
||||
# %gui tk
|
||||
global win
|
||||
win = Tk()
|
||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||
win.tk.eval("source "+os.path.realpath(os.path.join(_netgen_bin_dir, 'ng.tcl')).replace('\\','/'))
|
||||
|
||||
if not netgen.libngpy._meshing._netgen_executable_started:
|
||||
StartGUI()
|
||||
|
Loading…
Reference in New Issue
Block a user