...
This opens the typical Python console:
in Windows:
in Linux:
Code Block language py gid-user@linux:~ $ $HOME/GiDx64/gid-16.1.2d/scripts/tohil/python/python Python 3.10.8 (main, Oct 27 2022, 17:52:20) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print( "Hello World !!!"); Hello World !!! >>>
This python process is not related with the gid.exe process (it is not an embedded Python)
It can be used for example to run a GiD problemtype Python-based solver, without need to install installing an extra Python, the one of GiD could be usedby using GiD’s python, and its relative location is known a priori known.
If this process is killed the gid process is not affected, and they don’t share any memory.
It is possible to import the tohil
module in this Python interpreter to call Tcl commands, but this will create a new Tcl interpreter with the standard Tcl commands. Cannot use here Thus GiD commands like tohil.call( 'GiD_Info', 'mesh', 'nodes', '-array')
or tcl.GiD_Info( 'mesh', 'nodes', '-array')
can not be called.
Example:
Code Block | ||
---|---|---|
| ||
gid-user@linux:~ $ $HOME/GiDx64/gid-16.1.2d/scripts/tohil/python/python
Python 3.10.8 (main, Oct 27 2022, 17:52:20) [GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tkinter import *
>>> from tkinter import ttk
>>> root = Tk()
>>> frm = ttk.Frame( root, padding = 10)
>>> frm.grid()
>>> ttk.Label( frm, text = "Helo World !!!").grid( column = 0, row = 0)
>>> ttk.Button( frm, text = "Quit", command = root.destroy).grid( column = 1, row = 0)
>>> root.mainloop()
|