...
Code Block |
---|
f=open('C:/temp/my_debug.txt','a') f.write('hello world\n') f.close() |
Python show text with the W GiD proc
If Python is running in GiD then can call the Tcl GiD procedure called W that show text in a window
...
Note: tcl = tohil.import_tcl()
is a tohil module command that uses Tcl’s introspection capabilities to create Python object functions methods for each tcl Tcl proc and command, so that calling the Tcl procs looks very much like calling any Python function.
Warning: the Python functions methods created depends on the procs existing when tohil.import_tcl()
is invoked. If a proc like W is already not defined in Tcl during this call, the function Python method tcl.W('hello world') won’t exists!!, but tohil.call('W','hello world') will works.
Warning: It seems that tcl.W() cannot be called from the IDLE shell window or will crash
...