PythonWin: Adding Context Sensive Help

dique chezdique at yahoo.com
Mon Dec 30 09:53:01 EST 2002


It's very handy to have context sensitive help when writing programs.
Digging into the PythonWin sources a bit, turns out that adding
context sensitive help to PythonWin is not too hard:
Just need to add a few lines to [Extensions] in
D:\Python22\Lib\site-packages\Pythonwin\pywin\default.cfg (Your path
may vary.)

def ContextPythonHelp(editor_window, event):
    edit = editor_window.text.edit
    query = edit.GetSelText()
    import win32help
    win32help.HtmlHelp(0, r'D:\Python22\Doc\pyhelp.chm',
win32help.HH_DISPLAY_INDEX, query)

then bind a key to ContextPythonHelp in [Keys]:
F1                = ContextPythonHelp

You may use the ActivePython .chm help file or grab one here:
http://www.orgmf.com.ar/condor/pytstuff.html

I also made the `find' dialog box showing as default the text
currently selected. (Need to modify a source file or two.)



More information about the Python-list mailing list