tags:

views:

218

answers:

2

I want to copy a file to a FTP server using wxFTP, but I would like to do this without blocking the UI, and much better, while displaying a progress bar. Can I do this without extra thread?

I'm using wxLua, but I can adapt a solution written in any language as long as it uses a wxWidgets binding.

A: 

What's wrong with starting your own Thread for this?

You could check the streams canRead() method periodically (through a timer or in the event loop, maybe) and only read when it returns true, but it'll probably be a lot more complex than just starting a separate thread.

Joachim Sauer
I just wondered if I could do this with wxFTP, as I can do this with wxSocket*
Jazz
+1  A: 

Try using wx.lib.delayedresult. It's available in wxPython, but maybe also it is in your wxWidgets library too. It creates separate worker thread and is called with a consumer function that is called once worker thread finishes his job. Quite useful thing.

See wxPython docs for details.

Abgan