[wxPython] wxProcess

Hi,

  In the latest demo, the new feature wxProcess works great
in the example given. The script in the data directory, echo.py
simply takes stdin and sends it to stdout.

  If I change echo.py to do something after taking the input, which
takes a few seconds, I won't see an update in the wxPanel until I
move the mouse.

  Any suggestions?

# echo.py
# The only thing I changed was adding a line that does something
# for a few seconds after the readline()

import sys

sys.stdout.write( __doc__)
sys.stdout.flush()

line = sys.stdin.readline()

# Do something for a few seconds.

while line:
    line = line[:-1]
    sys.stdout.write('\nYou typed "%s"\n' % line)
    sys.stdout.flush()
    line = sys.stdin.readline()

sys.stdout.write('\nExiting...\n')
sys.stdout.flush()

···

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users

  In the latest demo, the new feature wxProcess works great
in the example given. The script in the data directory, echo.py
simply takes stdin and sends it to stdout.

  If I change echo.py to do something after taking the input, which
takes a few seconds, I won't see an update in the wxPanel until I
move the mouse.

That's because it's checking for output in idle event handlers, which only happens when the event queue becomes empty. (By moving the mouse you are generating events and then the queue becomes empty again.)

  Any suggestions?

Be more agressive about polling for output from the child process. You can call event.RequestMore() in the idle handler to get more idle events, but then the app sits and spins using more CPU than it needs to. Or you can use a timer to check more frequently and on a regular basis.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users