[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QMovie start/stop from a different thread
From: tom <tomschuring () gmail ! com>
Date: 2009-11-26 0:07:37
Message-ID: 41db0d900911251607r71a99010y80d271d31265989d () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
thanks david,
i was looking for a code example of that. all the examples i found are using
existing 'events' like clicked() of a button.
figured it out in the end so for others looking for something similar:
i ended up creating a function like:
def startMyMove(self):
self.movie.setPaused(False)
def stopMyMove(self):
self.movie.setPaused(False)
linking them like
self.connect(self, QtCore.SIGNAL("startMyMovie()"),
self. startMyMovie )
self.connect(self, QtCore.SIGNAL("stopMyMovie()"),
self. stopMyMovie )
in the constructor
and when i want it to start or stop i call :
self.emit(QtCore.SIGNAL("startMyMovie()") )
or
self.emit(QtCore.SIGNAL("stopMyMovie()") )
from within the thread
seems to work
thanks all !!
2009/11/26 David Boddie <david@boddie.org.uk>
> On Wed, 25 Nov 2009 16:35:28 +1100, tom wrote:
>
> > i create a QMovie in the main thread :
> >
> > self.movie = QMovie("images\whitephone-animation.mng",
> > QByteArray(), self)
> > self.movie.setCacheMode(QMovie.CacheAll)
> > self.movie.setSpeed(100)
> > self.movie_canvas.setMovie(self.movie)
>
> [...]
>
> > can i call the start / stop slots from within that different thread, and
> > how would i do that ?
>
> Connect signals to the movie's start() and stop() slots, and emit them when
> you need to start or stop it.
>
> David
>
> _______________________________________________
> PyQt mailing list PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
[Attachment #5 (text/html)]
thanks david,<div><br></div><div>i was looking for a code example of that. all the \
examples i found are using existing 'events' like clicked() of a \
button.</div><div><br></div><div>figured it out in the end so for others looking for \
something similar:</div> <div><br></div><div>i ended up creating a function \
like:</div><div><br></div><div>def startMyMove(self):</div><div> \
self.movie.setPaused(False)</div><div><br></div><div><div>def \
stopMyMove(self):</div><div> self.movie.setPaused(False)</div> \
</div><div><br></div><div>linking them like </div><div><br></div><div><div> \
self.connect(self, QtCore.SIGNAL("startMyMovie()"), self. startMyMovie ) \
</div><div> self.connect(self, QtCore.SIGNAL("stopMyMovie()"), self. \
stopMyMovie ) </div> <div><br></div><div>in the \
constructor</div><div><br></div><div>and when i want it to start or stop i call \
:</div><div><br></div><div>self.emit(QtCore.SIGNAL("startMyMovie()") \
)</div><div>or</div><div>self.emit(QtCore.SIGNAL("stopMyMovie()") )</div> \
<div><br></div><div>from within the thread</div><div><br></div><div>seems to \
work</div><div><br></div><div>thanks all !!</div><br><div \
class="gmail_quote">2009/11/26 David Boddie <span dir="ltr"><<a \
href="mailto:david@boddie.org.uk">david@boddie.org.uk</a>></span><br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex;"><div class="im">On Wed, 25 Nov 2009 16:35:28 +1100, tom \
wrote:<br> <br>
> i create a QMovie in the main thread :<br>
><br>
> self.movie = QMovie("images\whitephone-animation.mng",<br>
> QByteArray(), self)<br>
> self.movie.setCacheMode(QMovie.CacheAll)<br>
> self.movie.setSpeed(100)<br>
> self.movie_canvas.setMovie(self.movie)<br>
<br>
</div>[...]<br>
<div class="im"><br>
> can i call the start / stop slots from within that different thread, and<br>
> how would i do that ?<br>
<br>
</div>Connect signals to the movie's start() and stop() slots, and emit them \
when<br> you need to start or stop it.<br>
<font color="#888888"><br>
David<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
PyQt mailing list <a \
href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br> \
</div></div></blockquote></div><br></div>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic