...
If Python is running in GiD then can call the Tcl GiD procedure called W that show text in a window
e.g.
Code Block | ||
---|---|---|
| ||
GiD_Python_Exec { import tohil tcl=tohil.import_tcl() a=5.2 tcl.W(a) b=a*3 tcl.W(b) } |
will show a GiD window with the value of the variable avariables 'a' and 'b'
...
Note: tcl = tohil.import_tcl()
is a tohil module command that uses Tcl’s introspection capabilities to create Python object functions for each tcl proc and command, so that calling the Tcl procs looks very much like calling any Python function.
But Warning: the Python functions created depends on the procs existing when tohil.import_tcl()
is invoked. If the a proc like W is already not defined in Tcl during this call, the function tcl.W() won’t exists!!And the proc W is not defined initially. If a command is called but doesn’t exists, Tcl try to load its source file (based on the content of the tclIndex file that maps procs and filenames)
Warning: It seems that tcl.W() cannot be called from the IDLE shell window or will crash
By now do not try something like this or GiD will crash:
...
In this case it is less interesting to be used, because can use print(). The most interesting case is to use to debug code of GiD_Python_Exec
, or GiD_Python_Source