[PyQt] Threads with PyQt. Qt's or Python's?

Albert Cervera i Areny albert at nan-tic.com
Tue Feb 3 14:49:42 GMT 2009


A Dimarts 03 Febrer 2009, Frédéric va escriure:
> PS: does it already exist a simple solution to adapt this code:
>
>     thread = threading.Thread(target=func)
>     thread.start()
>
> using QThread?

Not that I know of, but it's trivial to implement. Something like this should 
do:

class FunctionThread(QThread):
	def __init__(self, function, parent=None):
		QThread.__init__(self, parent)
		self.function = function

	def run(self):
		self.function()

>
> --
>    Frédéric
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 
Albert Cervera i Areny
http://www.NaN-tic.com


More information about the PyQt mailing list