On 31/03/2011 11:53, Mark Hammond wrote:
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.
My function to clear the screen, sorry I should have been explicit, it's
given below.
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?
This is what I set up.
c:\Python27\Lib\site-packages\pythonwin\pywin>type mine.cfg
[General]
BasedOn = Default
[Keys:Interactive]
Alt+C = cls
[Extensions]
def cls(editor_window, event):
from pywin.framework import interact
interact.edit.currentView.SetSel(0, -1)
interact.edit.currentView.Clear()
<EOF>
This will clear the screen but there's no interactive prompt. Then type
any command you like and nothing happens,no errors, no output, zilch.
But you can select what you've typed with Ctrl-A and copy it with
Ctrl-C, which is exactly what I've done with the following three lines.
help(set)
a = 1.0
this is junk
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.
Ctrl-R or Ctrl-Shift-R work fine for me but they're not in the default
config *FILE* as per:-
c:\Python27\Lib\site-packages\pythonwin\pywin>grep -i Ctrl default.cfg
Ctrl+W = ViewWhitespace
Ctrl+Shift+8 = ViewWhitespace # The MSVC default key def.
Ctrl+Shift+F = ViewFixedFont
Ctrl+Space = <<expand-word>>
Ctrl+F3 = AutoFindNext
Ctrl+F2 = ToggleBookmark
Ctrl+G = GotoLine
Ctrl+T = <<toggle-tabs>>
Ctrl+Up = <<history-previous>>
Ctrl+Down = <<history-next>>
Ctrl+Enter = ProcessEnter
# When docked, the Ctrl+Tab and Shift+Ctrl+Tab keys dont work as expected.
Ctrl+Tab = MDINext
Ctrl+Shift+Tab = MDIPrev
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?
The above URL refers to
http://sourceforge.net/tracker/?func=detail&aid=2813056&group_id=78018&atid=551956).
You checked in the changes at 2010-08-27 07:37:51 UTC :)
Cheers,
Mark
Regards.
Mark L.
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32