[python-win32] Clear the interactive screen

Mark Hammond skippy.hammond at gmail.com
Sun Mar 27 08:53:04 CEST 2011


Try something like:

from pywin.framework import interact
interact.edit.currentView.SetSel(0, -1)
interact.edit.currentView.Clear()

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