[PySide] Updating progress bar value through a thread

Matthew Woehlke matthew.woehlke at kitware.com
Mon Jun 24 18:46:03 CEST 2013


On 2013-06-23 22:59, Dina Taha wrote:
> I'm kinda new in GUI programming with PySide, and in Python GUI in general.
> I'm trying to set a progress bar value using a thread, but it doesn't work
> and there is these errors that keeps on appearing:

You can't (safely, at least) do this in C++ Qt either. Basically, your 
thread needs to deliver a signal/event to your GUI thread to update the 
progress bar.

You could do this by emitting a signal that the progress has changed, 
and connect it to a slot to update the progress (e.g. 
QProgressBar::setValue). Or you can use QMetaObject::invokeMethod to 
"directly" (sends an event behind the scenes) invoke the slot across 
threads.

-- 
Matthew




More information about the PySide mailing list