[code.view]

[top] / python / PyMOTW / readline / readline_hooks.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     import readline
     
     def startup_hook():
         readline.insert_text('from startup_hook')
     
     def pre_input_hook():
         readline.insert_text(' from pre_input_hook')
         readline.redisplay()
     
     readline.set_startup_hook(startup_hook)
     readline.set_pre_input_hook(pre_input_hook)
     readline.parse_and_bind('tab: complete')
     
     while True:
         line = raw_input('Prompt ("stop" to quit): ')
         if line == 'stop':
             break
         print 'ENTERED: "%s"' % line
     

[top] / python / PyMOTW / readline / readline_hooks.py

contact | logmethods.com