Interesting exchange today on the slack channel about how you might approach getting the contents of the textport into a window for your output. I don’t know if there’s a direct way to access the contents of the textport, and I don’t think I’d actually want that. Instead you might write up a little method to help handle just those things.
In the provided example you can see how you might go about setting up an extension to smartly handle updating a table with a string as well as how to clean up that table, and make sure that the latest message still manages to get displayed.
I don’t know if it’s handy for anyone else, but figured that it was worth sharing even if it helped one person. base_printDispExample.tox (2.92 KB)
For a more complete description see the doc strings in the extension.
Great component.
A tip that may or may not be useful here:
You can redirect stdout, stderr to any DAT you wish:
#you'll want to stash these somewhere
o = sys.stdout
e = sys.stderr
#point to a DAT
sys.stdout = op('/project1/text1')
sys.stderr = op('/project1/text1')
....print, generate errors, etc...
#restore
sys.stdout = o
sys.stderr = e
It doesn’t capture prompts or what you type, but maybe it should next.
This is very cool, thanks for sharing. But the auto-scroll isn’t working for me. The parent().StartRow and parent().EndRow expressions don’t update until I toggle the Select DAT bypass off/on. I’m using version 2021.16124. This is easy to reproduce by simply importing the attached TOX in a fresh project and waiting 11 seconds for the text output to fill up.