Saving the Interactive Window with PythonWin

V

vsoler

Hi everyone,

When I run a python script, I know that I can print the results of my
calculations on the Interactive Window. Once the scripts ends, I can
copy/pate these results on an OpenOffice Writer document.

However, I would like to know if I can somehow add some lines to my
script, so that it saves the Interactive Window to a text file. How
could it be done?

And, is there a way to programatically clear out the Interactive
Window so that it only shows the last run?

Thank you for your help
 
M

Mark Hammond

Hi everyone,

When I run a python script, I know that I can print the results of my
calculations on the Interactive Window. Once the scripts ends, I can
copy/pate these results on an OpenOffice Writer document.

However, I would like to know if I can somehow add some lines to my
script, so that it saves the Interactive Window to a text file. How
could it be done?

The code for the interactive window is in pywin32\framework\interact.py
- eg:

If it is visible, then something like:

should get you on the right path.
And, is there a way to programatically clear out the Interactive
Window so that it only shows the last run?

Something like:

interact.edit.currentView.GetWindowText('line1\nline2\nline3')

should work - the first few lines will always be formatted using blue
text, and the above works a little strangely when attempting it directly
from the interactive prompt, but might still be useful. See the source
file I mentioned above for more clues.

HTH,

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,268
Latest member
AshliMacin

Latest Threads

Top