Re: wxPython and threads

2007-07-19 Thread Nick Craig-Wood
Josiah Carlson <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > I'd dispute that. If you are communicating between threads use a > > Queue and you will save yourself thread heartache. Queue has a non > > blocking read interface Queue.get_nowait(). > > If you have one producer and one co

Re: wxPython and threads

2007-07-19 Thread Josiah Carlson
Nick Craig-Wood wrote: > Josiah Carlson <[EMAIL PROTECTED]> wrote: >> Sending results one at a time to the GUI is going to be slow for any >> reasonably fast search engine (I've got a pure Python engine that does >> 50k results/second without breaking a sweat). Don't do that. Instead, >> h

Re: wxPython and threads

2007-07-19 Thread Nick Craig-Wood
Josiah Carlson <[EMAIL PROTECTED]> wrote: > Sending results one at a time to the GUI is going to be slow for any > reasonably fast search engine (I've got a pure Python engine that does > 50k results/second without breaking a sweat). Don't do that. Instead, > have your search thread create

Re: wxPython and threads

2007-07-19 Thread Iain King
On Jul 18, 3:41 am, Benjamin <[EMAIL PROTECTED]> wrote: > I'm writing a search engine in Python with wxPython as the GUI. I have > the actual searching preformed on a different thread from Gui thread. > It sends it's results through a Queue to the results ListCtrl which > adds a new item. This work

Re: wxPython and threads

2007-07-19 Thread Josiah Carlson
Benjamin wrote: > I'm writing a search engine in Python with wxPython as the GUI. I have > the actual searching preformed on a different thread from Gui thread. > It sends it's results through a Queue to the results ListCtrl which > adds a new item. This works fine or small searches, but when the >

Re: wxPython and threads

2007-07-18 Thread James Matthews
Sounds like a race condition. is List Ctrl waiting for the gui to return? Maybe make the processing more then one thread! On 7/17/07, Stef Mientki <[EMAIL PROTECTED]> wrote: Benjamin wrote: > I'm writing a search engine in Python with wxPython as the GUI. I have > the actual searching preformed

Re: wxPython and threads

2007-07-17 Thread Stef Mientki
Benjamin wrote: > I'm writing a search engine in Python with wxPython as the GUI. I have > the actual searching preformed on a different thread from Gui thread. > It sends it's results through a Queue to the results ListCtrl which > adds a new item. This works fine or small searches, but when the >

wxPython and threads

2007-07-17 Thread Benjamin
I'm writing a search engine in Python with wxPython as the GUI. I have the actual searching preformed on a different thread from Gui thread. It sends it's results through a Queue to the results ListCtrl which adds a new item. This works fine or small searches, but when the results number in the hun

Re: wxPython and threads again

2005-08-11 Thread Peter Hansen
David E. Konerding DSD staff wrote: > http://wxwidgets.org/manuals/2.6.1/wx_threadfunctions.html#threadfunctions > > This strongly suggests you can arbitrarily grab the wx GUI lock and call GUI > functions from any thread. It's still voodoo. But we're adults here, and > practicing > voodoo isn'

Re: wxPython and threads again

2005-08-11 Thread David E. Konerding DSD staff
On 2005-08-10, Peter Hansen <[EMAIL PROTECTED]> wrote: > David E. Konerding DSD staff wrote: >> Further, calling wx from a thread other than the one running the event > > loop is deep voodoo and should typically be avoided. > > "Typically"? Let's just say "always" and maybe use the phrase "certai

Re: wxPython and threads again

2005-08-11 Thread David E. Konerding DSD staff
On 2005-08-10, Bryan Olson <[EMAIL PROTECTED]> wrote: > > The easiest approach, though, is to use the threadedselectreactor in > Twisted (you need > > to check the HEAD branch out with subversion, because that reactor > isn't included in any releases). > > With threadedselectreactor, it's easy to

Re: wxPython and threads again

2005-08-10 Thread Christopher Subich
David E. Konerding DSD staff wrote: > The easiest approach, though, is to use the threadedselectreactor in Twisted > (you need > to check the HEAD branch out with subversion, because that reactor isn't > included in any releases). > With threadedselectreactor, it's easy to incorporate both the GU

Re: wxPython and threads again

2005-08-10 Thread Bryan Olson
Peter Hansen wrote: > David E. Konerding DSD staff wrote: >> Further, calling wx from a thread other than the one running the >> event loop is deep voodoo and should typically be avoided. > > "Typically"? Let's just say "always" and maybe use the phrase "certain > to corrupt wx and crash the

Re: wxPython and threads again

2005-08-10 Thread perchef
thanks for all these advices. I think a custom event will be the way to go. for the moment I use something _really_ ugly : a mix between GUI, threads and recursive fonctions. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython and threads again

2005-08-10 Thread Peter Hansen
David E. Konerding DSD staff wrote: > Further, calling wx from a thread other than the one running the event > loop is deep voodoo and should typically be avoided. "Typically"? Let's just say "always" and maybe use the phrase "certain to corrupt wx and crash the app" instead of "deep voodoo".

Re: wxPython and threads again

2005-08-10 Thread Bryan Olson
David E. Konerding DSD staff wrote: [...] > You need another way to pass completion information between the downloader > thread and the main thread; the simplest way is to define a custom wx > Event, and wxPostEvent from the downloader thread when it completes ( > and when the gauge should be

Re: wxPython and threads again

2005-08-10 Thread David E. Konerding DSD staff
In article <[EMAIL PROTECTED]>, perchef wrote: > Hi, > > I have several files to download and a GUI to update. I know this is a > frequently asked question but i can't find an appropriate solution. > My Downloader extends threading.Thread and update a wx.Gauge in GUI > during the process. > > for

wxPython and threads again

2005-08-10 Thread perchef
Hi, I have several files to download and a GUI to update. I know this is a frequently asked question but i can't find an appropriate solution. My Downloader extends threading.Thread and update a wx.Gauge in GUI during the process. for src in urls: downloader = Downloader( src, destination,

Re: asynchronous comunication, wxPython and threads.

2005-06-22 Thread Zunbeltz Izaola
On Wed, 22 Jun 2005 09:28:31 -0400, Peter Hansen wrote: > Almost certainly it is. It would be simplest to set up a worker thread > once, when the GUI thread begins, and simply send requests to it via a > Queue. It can create the socket, connect to the server, communicate, > close it down, an

Re: asynchronous comunication, wxPython and threads.

2005-06-22 Thread Peter Hansen
Zunbeltz Izaola wrote: > I opened the socket once (i don't know if > itit is important to open inside or outside the comunication thread). I don't believe it is important where it is opened, provided you don't try to do things with it from two threads at a time (without adequate protection). >

Re: asynchronous comunication, wxPython and threads.

2005-06-22 Thread Zunbeltz Izaola
On Tue, 21 Jun 2005 11:07:35 -0400, Peter Hansen wrote: > > Please clarify: what does this mean? "Sending a socket" is not a usual > way to describe TCP communications. Do you mean your program _opens_ a > socket (like a phone connection) and _sends_ some data, then waits for > data to be re

Re: asynchronous comunication, wxPython and threads.

2005-06-21 Thread Peter Hansen
Zunbeltz Izaola wrote: > I'm developing a GUI program (wxPython). This program has to comunicate > (TCP) whit other program that controls a laboratory machine to do a > measurement. I have a dialog box, wiht two buttoms "Start measurement" and > "Stop". "Start" executes a function that do the measu

Re: asynchronous comunication, wxPython and threads.

2005-06-21 Thread Zunbeltz Izaola
On Tue, 21 Jun 2005 15:30:41 +0100, Toby Dickenson wrote: > On Tuesday 21 June 2005 14:22, Zunbeltz Izaola wrote: > > > I guess you are accessing the socket from both your GUI thread and > communications thread. Dont do that. An action in the GUI thread should > signal the communictions thread

Re: asynchronous comunication, wxPython and threads.

2005-06-21 Thread Toby Dickenson
On Tuesday 21 June 2005 14:22, Zunbeltz Izaola wrote: > This comunication is done in a new thread not to frezee the GUI. > The problem is that when "Stop" is done (it kills the thread) some > confirmation sockets are mixed (are not receibed in the correct order > although i use tcp). I guess you

asynchronous comunication, wxPython and threads.

2005-06-21 Thread Zunbeltz Izaola
Hi, I have the following problem. I'm developing a GUI program (wxPython). This program has to comunicate (TCP) whit other program that controls a laboratory machine to do a measurement. I have a dialog box, wiht two buttoms "Start measurement" and "Stop". "Start" executes a function that do the