Re: [PyQt] setText from threading

2008-02-21 Thread Andreas Pakulat
On 21.02.08 22:58:00, Aaron Digulla wrote: > Reinaldo de Carvalho schrieb: > > > The objective of this thread is only dont freeze window. No concurrent > > acccess will happen to GUI components. A have a hundred of methods > > called by pushButtons or SIGNALs from Qlistview like itemChanged, that

Re: [PyQt] setText from threading

2008-02-21 Thread Aaron Digulla
Reinaldo de Carvalho schrieb: > The objective of this thread is only dont freeze window. No concurrent > acccess will happen to GUI components. A have a hundred of methods > called by pushButtons or SIGNALs from Qlistview like itemChanged, that > manipulate the GUI mainly to populate many QListVie

Re: [PyQt] setText from threading

2008-02-21 Thread Reinaldo de Carvalho
> > That's pure chance. Eventually, your app will do something it shouldn't > and it will "suddenly" break. You simply can't rely that it will be > stable (even if some things will in fact work). The objective of this thread is only dont freeze window. No concurrent acccess will happen to GUI

Re: [PyQt] setText from threading

2008-02-21 Thread Aaron Digulla
Reinaldo de Carvalho schrieb: > Why is possible access GUI from any thread? This seems not to be > allowed (Phil say "design error") but my application is running > without problems. That's pure chance. Eventually, your app will do something it shouldn't and it will "suddenly" break. You simply c

Re: [PyQt] setText from threading

2008-02-21 Thread Reinaldo de Carvalho
> Mark's book has a chapter dedicated to threading... > > http://www.qtrac.eu/pyqtbook.html > > ...or there is the Qt docs... > >From http://doc.trolltech.com/4.3/threads.html: "Note that QCoreApplication::exec() must always be called from the main thread (the thread that executes main()), not f

Re: [PyQt] setText from threading

2008-02-21 Thread Phil Thompson
On Thursday 21 February 2008, Rafał Zawadzki wrote: > Thursday 21 February 2008 14:35:50 Phil Thompson napisał(a): > > On Thursday 21 February 2008, Reinaldo de Carvalho wrote: > > > "threading" dont have postEvent-like then I must use Qthread? > > > > You could use the standard Python Queue and in

Re: [PyQt] setText from threading

2008-02-21 Thread Phil Thompson
On Thursday 21 February 2008, Reinaldo de Carvalho wrote: > > > QThread can be called with threding "target=" like argument? I will > > > like start methods from PushButtons without freeze mainWidget when > > > execute. > > > > Just reimplement QThread.run() and call your simulate() function. >

Re: [PyQt] setText from threading

2008-02-21 Thread Rafał Zawadzki
Thursday 21 February 2008 14:35:50 Phil Thompson napisał(a): > On Thursday 21 February 2008, Reinaldo de Carvalho wrote: > > "threading" dont have postEvent-like then I must use Qthread? > > You could use the standard Python Queue and in the main thread convert them > to events and post them locall

Re: [PyQt] setText from threading

2008-02-21 Thread Reinaldo de Carvalho
> > > QThread can be called with threding "target=" like argument? I will > > like start methods from PushButtons without freeze mainWidget when > > execute. > > > Just reimplement QThread.run() and call your simulate() function. > I have one hundred methods called by pushButtons, then a need

Re: [PyQt] setText from threading

2008-02-21 Thread Phil Thompson
On Thursday 21 February 2008, Reinaldo de Carvalho wrote: > "threading" dont have postEvent-like then I must use Qthread? You could use the standard Python Queue and in the main thread convert them to events and post them locally - but using QThread is easier. > QThread can be called with thredi

Re: [PyQt] setText from threading

2008-02-21 Thread Reinaldo de Carvalho
"threading" dont have postEvent-like then I must use Qthread? QThread can be called with threding "target=" like argument? I will like start methods from PushButtons without freeze mainWidget when execute. -- Reinaldo Carvalho On 2/21/08, Phil Thompson <[EMAIL PROTECTED]> wrote: > On Thursday

Re: [PyQt] setText from threading

2008-02-21 Thread Phil Thompson
On Thursday 21 February 2008, Reinaldo de Carvalho wrote: > I solved the problem setting null strig to textLabel1 before start thread: > > [...] > > def thread_start( self ): >self.gbox.setEnabled(False) >self.textLabel1.setText("") >self.thread1 = threading.Thread(target=self.simulate)

Re: [PyQt] setText from threading

2008-02-21 Thread Reinaldo de Carvalho
I solved the problem setting null strig to textLabel1 before start thread: [...] def thread_start( self ): self.gbox.setEnabled(False) self.textLabel1.setText("") self.thread1 = threading.Thread(target=self.simulate) self.thread1.setDaemon(1) self.thread1.start() def simulate( sel

Re: [PyQt] setText from threading

2008-02-20 Thread Richard A. Johnson
On Wednesday 20 February 2008, Algis Kabaila wrote: [...] | In quietly reading the mail on this list, I have seen repeated references | that "PyQt comes with examples" -- where exactly are those examples? It | seems that "everybody knows", except me... python-qt4-docs I believe is the package yo

Re: [PyQt] setText from threading

2008-02-20 Thread Andreas Pakulat
On 21.02.08 09:23:55, Algis Kabaila wrote: > On Thu, 21 Feb 2008 07:32:47 Andreas Pakulat wrote: > > On 20.02.08 15:59:31, Reinaldo de Carvalho wrote: > [..] > > No, but PyQt comes with examples and that includes examples which use > > threads and events I think. > [..] > > Andreas > > In quietly

Re: [PyQt] setText from threading

2008-02-20 Thread Algis Kabaila
On Thu, 21 Feb 2008 07:32:47 Andreas Pakulat wrote: > On 20.02.08 15:59:31, Reinaldo de Carvalho wrote: [..] > No, but PyQt comes with examples and that includes examples which use > threads and events I think. [..] > Andreas In quietly reading the mail on this list, I have seen repeated reference

Re: [PyQt] setText from threading

2008-02-20 Thread Andreas Pakulat
On 20.02.08 15:59:31, Reinaldo de Carvalho wrote: Sending to the list again. > You have a sample code? No, but PyQt comes with examples and that includes examples which use threads and events I think. Those are probably using QThread instead of python threads, so things might work a bit differen

Re: [PyQt] setText from threading

2008-02-20 Thread Andreas Pakulat
On 20.02.08 14:26:37, Reinaldo de Carvalho wrote: > PyQt3 3.16 (Debian etch), my program use Qt3, i cant update to PyQt4 now. You can't change Qt gui components from a thread other than the gui thread. You have to implement some notification mechanism between your thread and gui components. A comm

[PyQt] setText from threading

2008-02-20 Thread Reinaldo de Carvalho
PyQt3 3.16 (Debian etch), my program use Qt3, i cant update to PyQt4 now. [...] def thread_start( self ): self.gbox.setEnabled(False) self.thread1 = threading.Thread(target=self.simulate) self.thread1.setDaemon(1) self.thread1.start() def simulate( self ): i = 0 while i < 10: