[Pythonmac-SIG] Re: Now this is pretty cool...
Dean & Yang Draayer
draayer@surfglobal.net
Sat, 21 Jul 2001 17:14:21 -0400
> I think I would prefer it if IDE provided a hook into this, or if
> someone donated an IDE script for this (how about something that
looks
> up help on the current selection, and if there is no selection shows
a
> dialog box in which you can type the thing you want to look up?).
I came up with the following script that seems to work well in the
Scripts menu of Python IDE.
#=============================================
# 'Online Help....py'
#
# Provides access to the on-line help
# generated by the pydoc module.
#
# This script is intended for use in the
# Python IDE Scripts menu (MacPython only).
#=============================================
if sys.platform != 'mac':
sys.exit("This script works only in MacPython.")
if __name__ == '__main__':
from EasyDialogs import AskString
from pydoc import Helper
import sys
helper = Helper(sys.stdin, sys.stdout)
topic = AskString('Help topic:', '')
if topic != None: # user didn't cancel
if topic == '':
helper.intro()
else:
helper.help(topic)
#=== end 'Online Help....py' ===
It doesn't do the 'current selection' trick - not yet anyway. I'll
look into adding this feature. If this works to everyone's
satisfaction, it might be a good idea to incorporate this in the Help
menu instead of the Scripts menu.
One minor annoyance: when the AskString dialog comes up, the cursor
remains a watch cursor. It really should revert to an arrow cursor.
Cheers,
Dean Draayer
draayer@surfglobal.net