Saving the Interactive Window with PythonWin
skippy.hammond at gmail.com
Mon Feb 22 00:47:34 CET 2010
On 22/02/2010 4:28 AM, vsoler wrote:
> 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
>>> from pywin.framework import interact
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?
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.
> Thank you for your help
More information about the Python-list