[IPython-dev] Non-blocking interact() for GUI/IPython1 use

Ville M. Vainio vivainio@gmail....
Fri Feb 1 10:51:14 CST 2008

In the interest of making ipython trunk more likely to fit into the
ipython1 framework, I made the blocking raw_input read_eval_print

I created

def interact_prompt(self):

def interact_handle_input(self,line):

These can be used to create GUIs (that of course want to handle their
own input-waiting) for IPython.

Here is a demo on how to use it, but of course this demo uses plain
old readline and blocking raw_input:

    def interact_with_readline(self):
        """ Demo of using interact_handle_input, interact_prompt

        This is the main read-eval-print loop. If you need to
implement your own (e.g. for GUI),
        it should work like this.
        while not self.exit_now:
            if self.more:
                self.rl_do_indent = True
                self.rl_do_indent = False
            line = raw_input_original().decode(self.stdin_encoding)

Currently, interact_with_readline() is not called in IPython, but it
works pretty much exactly like the standard interact().

Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'

More information about the IPython-dev mailing list