[python-win32] Clear the interactive screen

Blockheads Oi Oi breamoreboy at yahoo.co.uk
Wed Mar 30 17:41:21 CEST 2011


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.  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.

>
> HTH,
>
> Mark
>
> On 26/03/2011 1:28 AM, Blockheads Oi Oi wrote:
>> Hi all,
>>
>> my take on a way to achieve this, and apologies if someone has posted a
>> better method that I don't know about:-
>>
>> from SendKeys import SendKeys
>> def cls():
>> SendKeys("^a{BS}~~", 0) # adjust to your needs
>>
>> I've tried to setup my own config file using ALT-R to call this and have
>> failed dismally, managing to clear my code window(s) amongst other
>> things. How do I correctly go about this?

I've tried wrapping the interact lines from above into a cls function in 
my own bare bones config file based on the data in the pywin32 help 
Keyboard Bindings section.  Screws everything.  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? 
  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?

>>
>> 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?
>>
>> Cheers.
>>
>> Mark Lawrence.
>>
>> _______________________________________________
>> python-win32 mailing list
>> python-win32 at python.org
>> http://mail.python.org/mailman/listinfo/python-win32




More information about the python-win32 mailing list