Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a scrollable screen in text mode with Python

Tags:

python

text

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)
like image 233
Barthelemy Avatar asked Feb 06 '10 12:02

Barthelemy


1 Answers

from pydoc import ttypager

def jhelp(object):
     text = # get text for object
     ttypager(text) # display a scrollable screen.
like image 137
pwdyson Avatar answered Oct 18 '22 20:10

pwdyson