[python-win32] Clear the interactive screen

Mark Hammond skippy.hammond at gmail.com
Thu Mar 31 12:53:46 CEST 2011


On 31/03/2011 2:41 AM, Blockheads Oi Oi wrote:
> On 27/03/2011 07:53, Mark Hammond wrote:
>> Try something like:
>>
>> from pywin.framework import interact
>> interact.edit.currentView.SetSel(0, -1)
>> interact.edit.currentView.Clear()
>
> Try the above three lines from the interactive prompt and nothing that I
> can see happens.

That is because line 2 selects all text in the window - but doing this 
interactively resets this.  The last line clears the selection - and 
interactively there is no selection to remove.

> Try the last two lines on a single line with the ;
> separator and the screen is cleared, I'm sorry but I don't understand this.

Hope that explains it.
>
> I've tried wrapping the interact lines from above into a cls function

I'm not sure what a cls function is.

> in
> my own bare bones config file based on the data in the pywin32 help
> Keyboard Bindings section. Screws everything.

Screws what?

> What steps are needed to
> get what I and others have asked for in the past, i.e. clear the
> interactive screen, run the program/module under test, resort to normal?

What exactly did you try?  How exactly did it not work?

> I observe that the Ctrl-R and Shift-Ctrl-R key combinations are not
> available in the default config file (presumably to keep bozos like
> myself away from them? :). So do we have to resort to (shock, horror,
> probe) doing things manually?

They should be - I use the default config and Ctrl+R works fine for me.

>>> I've also changed interact.py in accordance with
>>> http://code.activestate.com/lists/python-list/168244/. Is there any
>>> reason why this couldn't be part of the standard file?

I don't follow that list - was it ever posted to sourceforge?

Cheers,

Mark


More information about the python-win32 mailing list