[IPython-dev] [matplotlib-devel] [Enthought-Dev] Ctypes based prototype of PyOS_InputHook for wx 2.8 and 2.9

Brian Granger ellisonbg.net@gmail....
Thu Jul 16 23:59:50 CDT 2009


Michiel,

Thanks for the reply, this will help us to find a better approach.
According to one of the wx devs, Robin Dunn, wx currently does not have the
ability to monitor stdin in its even loop without polling.  I guess there is
a GSoC project to add this capability, but it is not there yet.  Any
thoughts on how this could be done without monitoring stdin.  I will give
the polling stdin approach a try though.

Cheers,

Brian



> The chunkiness probably comes from the fact that inputhook_wx is called
> repeatedly. This is different from how PyOS_InputHook is being used in
> Tkinter, PyGTK, and the Mac OS X backend.
>
> Schematically, this is how the Tkinter/PyGTK/MacOSX event loops work:
>
> 1) PyOS_InputHook is called when Python is waiting for the user to type in
> the next Python command.
>
> 2) The hook function sets up the event loop such that stdin is being
> monitored while the event loop is running.
>
> 3) The hook function then starts the event loop.
>
> 4) When input is available on stdin, the hook function exits the event
> loop, and returns.
>
> This is how the proposed Wx event loop currently works:
>
> 1) PyOS_InputHook is called when Python is waiting for the user to type in
> the next Python command.
>
> 2) The hook function processes whatever events are available at the time.
>
> 3) The hook function returns.
>
> 4) If still no input is available on stdin, Python calls the hook function
> again via PyOS_InputHook after a timeout.
>
> I believe the timeout is 0.1 seconds by default. However, Python may not
> call PyOS_InputHook repeatedly at all; this depends on which Python version
> is being used, and the version of the readline library. In some
> configurations (particularly on Windows), PyOS_InputHook is called only
> once, so wx will freeze between Python commands.
>
> I am not familiar with wx, but there hopefully there is some way to monitor
> stdin while the event loop is running?
>
> --Michiel.
>
>
> --- On Thu, 7/16/09, Brian Granger <ellisonbg.net@gmail.com> wrote:
>
> > From: Brian Granger <ellisonbg.net@gmail.com>
> > Subject: Re: [matplotlib-devel] [IPython-dev] [Enthought-Dev] Ctypes
> based prototype of PyOS_InputHook for wx 2.8 and 2.9
> > To: "Robert Kern" <rkern@enthought.com>
> > Cc: enthought-dev@enthought.com, "matplotlib development list" <
> matplotlib-devel@lists.sourceforge.net>, "IPython Development list" <
> ipython-dev@scipy.org>
> > Date: Thursday, July 16, 2009, 6:57 PM
> > Robert,
> >
> > Thanks for testing this so quickly.  Performance is one of
> > the big issues that I am concerned about.  I will work on a
> > Cython based version to see if that solves the problem.
> >
> > Cheers,
> >
> > Brian
> >
> >
> >
> >
> > Works for me with wx 2.8.8.1 on OS X 10.5 and
> > Chaco. Pan and zoom
> >
> > interactions are substantially chunky, though. I do not see
> > such
> >
> > chunkiness with -wthread. It would be worth exploring a
> > Cython
> >
> > alternative to see if it is just ctypes and general Python
> > overhead to
> >
> > blame.
> >
> >
> >
> > --
> >
> > Robert Kern
> >
> >
> >
> > "I have come to believe that the whole world is an
> > enigma, a harmless
> >
> > enigma that is made terrible by our own mad attempt to
> > interpret it as
> >
> > though it had an underlying truth."
> >
> >   -- Umberto Eco
> >
> > _______________________________________________
> >
> > IPython-dev mailing list
> >
> > IPython-dev@scipy.org
> >
> > http://mail.scipy.org/mailman/listinfo/ipython-dev
> >
> >
> >
> >
> > -----Inline Attachment Follows-----
> >
> >
> ------------------------------------------------------------------------------
> > Enter the BlackBerry Developer Challenge
> > This is your chance to win up to $100,000 in prizes! For a
> > limited time,
> > vendors submitting new applications to BlackBerry App
> > World(TM) will have
> > the opportunity to enter the BlackBerry Developer
> > Challenge. See full prize
> > details at: http://p.sf.net/sfu/Challenge
> > -----Inline Attachment Follows-----
> >
> > _______________________________________________
> > Matplotlib-devel mailing list
> > Matplotlib-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
> >
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20090716/8b0734d1/attachment.html 


More information about the IPython-dev mailing list