Python
...
.print()
When Python is executed externally, in Windows, a DOS-console is opened and it is possible to use the Python function print() to show values in this console:
...
But running when executing python code inside GiD, this console doesn’t does not exists, and then thus, this command cannot be used, except in case that the IDLE shell is opened and then the output of print is showed therewhen using IDLE shell ( Utilities --> Tools → Console Python… ) .
Python print to file
To debug Python code it is always possible (inside and outside GiD) to print data of variables to a file, with something like this:
Code Block | ||
---|---|---|
| ||
f=open('C:/temp/my_debug.txt','a') f.write('hello world\n') f.close() |
Python to show text with the
...
GiD proc W
If Python is running in GiD then can call the Tcl GiD procedure called W that show W can be called, which shows 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) } |
...