trouble w/ buffered output

Hello-

I have written a small wxPython application which is a media file
uploader to be used with a custom CSM/DAM we use here at UT Austin.
It uses httplib to "POST" a file to the CMS. The whole thing works
properly, except for the output. I am writing the output to a text
control, and nothing gets written until all of the files have uploaded
(perhaps output is buffered). I would like to have the output display
incrementally in real time. If I simply "print" the output, I see the
proper incremental output on the command line from which I launched
the app, but I cannot get that to work in a text control.

If it is of use, attached is the code.

thanks-
Peter Keane

uploader.py (5.84 KB)

Peter,

Hello-

I have written a small wxPython application which is a media file
uploader to be used with a custom CSM/DAM we use here at UT Austin.
It uses httplib to "POST" a file to the CMS. The whole thing works
properly, except for the output. I am writing the output to a text
control, and nothing gets written until all of the files have uploaded
(perhaps output is buffered). I would like to have the output display
incrementally in real time. If I simply "print" the output, I see the
proper incremental output on the command line from which I launched
the app, but I cannot get that to work in a text control.

If it is of use, attached is the code.

thanks-
Peter Keane
  
You'll probably want to take a look at this wiki entry:

http://wiki.wxpython.org/LongRunningTasks

I think any of those methods on that page would work. I do something very similar in this blog post series:

Hopefully that will get you going.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Hello,

You are running the upload job in the same thread as the gui so it is blocking the gui from doing the updates to the screen.

Options:

  1. You may be able to solve this by adding a call to wx.YieldIfNeeded() after each time you add text the text control this will make you function temporarly yield and allow the main thread to check and process any pending events.

or

  1. Move the upload code to a separate thread and post the update messages back to the main thread for display.

cody

···

On Fri, Sep 12, 2008 at 3:46 PM, Peter Keane pkeane@mail.utexas.edu wrote:

Hello-

I have written a small wxPython application which is a media file
uploader to be used with a custom CSM/DAM we use here at UT Austin.

It uses httplib to “POST” a file to the CMS. The whole thing works
properly, except for the output. I am writing the output to a text
control, and nothing gets written until all of the files have uploaded

(perhaps output is buffered). I would like to have the output display
incrementally in real time. If I simply “print” the output, I see the
proper incremental output on the command line from which I launched

the app, but I cannot get that to work in a text control.

If it is of use, attached is the code.

thanks-
Peter Keane


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Great! wx.YieldIfNeeded() did the trick.

many thanks-
Peter

···

On Fri, Sep 12, 2008 at 4:02 PM, Cody Precord <codyprecord@gmail.com> wrote:

Hello,

You are running the upload job in the same thread as the gui so it is
blocking the gui from doing the updates to the screen.

Options:

1) You may be able to solve this by adding a call to wx.YieldIfNeeded()
after each time you add text the text control this will make you function
temporarly yield and allow the main thread to check and process any pending
events.

or

2) Move the upload code to a separate thread and post the update messages
back to the main thread for display.

cody
On Fri, Sep 12, 2008 at 3:46 PM, Peter Keane <pkeane@mail.utexas.edu> wrote:

Hello-

I have written a small wxPython application which is a media file
uploader to be used with a custom CSM/DAM we use here at UT Austin.
It uses httplib to "POST" a file to the CMS. The whole thing works
properly, except for the output. I am writing the output to a text
control, and nothing gets written until all of the files have uploaded
(perhaps output is buffered). I would like to have the output display
incrementally in real time. If I simply "print" the output, I see the
proper incremental output on the command line from which I launched
the app, but I cannot get that to work in a text control.

If it is of use, attached is the code.

thanks-
Peter Keane

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users