mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-14 10:08:32 +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
|
namespace netgen
|
||||||
{
|
{
|
||||||
|
extern bool netgen_executable_started;
|
||||||
extern shared_ptr<NetgenGeometry> ng_geometry;
|
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)
|
DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||||
{
|
{
|
||||||
|
m.attr("_netgen_executable_started") = py::cast(netgen::netgen_executable_started);
|
||||||
|
|
||||||
py::class_<NGDummyArgument>(m, "NGDummyArgument")
|
py::class_<NGDummyArgument>(m, "NGDummyArgument")
|
||||||
.def("__bool__", []( NGDummyArgument &self ) { return false; } )
|
.def("__bool__", []( NGDummyArgument &self ) { return false; } )
|
||||||
;
|
;
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
from tkinter import Tk
|
import netgen
|
||||||
|
|
||||||
from . import _netgen_lib_dir
|
def StartGUI():
|
||||||
from . import _netgen_bin_dir
|
import os
|
||||||
|
from tkinter import Tk
|
||||||
|
|
||||||
win = Tk()
|
from . import _netgen_lib_dir
|
||||||
import os
|
from . import _netgen_bin_dir
|
||||||
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('\\','/'))
|
|
||||||
|
|
||||||
# %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