Reputation: 8757
I would like to create a scrollable screen in text mode, like the one obtained when typing help(object) in the interpreter. Is there a cross-platform module I can use to easily implement this?
For example:
>>> def jhelp(object):
>>> text = # get text for object
>>> display_text(text) # display a scrollable screen. How do I do this?
>>>
>>> l = [1,2,3]
>>> jhelp(l)
Upvotes: 6
Views: 1245
Reputation: 91490
I think what you really want is from pydoc import pager
. ttypager
is a very reduced pager, but pager
will automatically use a better pager (basically less
) if it is available.
Upvotes: 2
Reputation: 1177
from pydoc import ttypager
def jhelp(object):
text = # get text for object
ttypager(text) # display a scrollable screen.
Upvotes: 4