Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

But when executing python code inside GiD, this console does not exists, and thus, this command cannot be used, except when using IDLE shell ( Utilities --> Tools -> Develop -> Console Python… ) .

Python print to file

...

Using tohil.call('W','hello world') will work as it delegates to the internal tohil Tcl interpreter the execution of the string list parameters, instead of calling the Tcl-proc directly. This way the internal Tcl interpreter will look for the definition of the procedure W if it does not exists, and execute it with 'hello world' as parameter.

Warning: It seems that tcl.W() cannot can also be called from the IDLE shell window or will GiD will crash.
By now do not try something like this or GiD will crash:

...

At the moment, some of GiD’s window can be called from this IDLE shell and some others not.
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_Sourceof GiD Utilities-->Tools-->Python console...:

...

Warning: It seems that tcl’s command update cannot be called from the IDLE shell window, showing following message ( MS Windows and Linux):

...

But if you click ‘OK’ the code will continue its execution.
Be aware that the command update is used in several GiD's windows and utilities, so this error message will appear several times.
Note: on macOS tcl’s command update will cause GiD likely to crash.

And in windows also crash, to avoid it we have modified the source code of Modules\_tkinter.c and recompiled.