Primarily I would also suggest doing IO blocking operations in a QThread, which 
can signal when it has finished as well. 
The reason it freezes your UI is because although it calls append on the text 
widgets, the eventloop will not get a chance to flush those requests until 
control leaves the for loop. They just stack up until then. If its a loop of a 
bunch of very fast operations, you could also stick a processEvents call in 
there:

app = QtGui.QApplication.instance()
for i in aRange:
    some_operation()
    app.processEvents()

But if each operation is not quick then you should still use a QThread


On Sep 25, 2012, at 11:59 PM, Panupat Chongstitwattana <panup...@gmail.com> 
wrote:

> Ah Threading works. Thanks. I'll have to study more about it :)
> 
> Thanks
> 
> 
> On Wed, Sep 26, 2012 at 1:17 PM, zhang jian <zhangm...@gmail.com> wrote:
>> you should launch the operation in a separate thread, and send signal to ui 
>> after each copy.
>> 
>> zhang
>> 
>> On Wed, Sep 26, 2012 at 1:29 PM, Panupat Chongstitwattana 
>> <panup...@gmail.com> wrote:
>>> Using Python to loop copy lots of files. While copying, I tell PyQt to 
>>> append feedback to QTextEdit
>>> 
>>> for scr in sources:
>>>     shutil.copy(src, dst)
>>> 
>>> 
>>> 
>>>     self.feedback.append("Copying " + src)
>>> 
>>> self.feedback is a QTextEdit
>>> 
>>> When I start my script, PyQt would frozen up until all the copies are 
>>> completed before displaying everything back to be all at once.
>>> 
>>> How can I make it so that each feedback are shown back to me in real time 
>>> as the files are being copied?
>>> 
>>> -- 
>>> view archives: http://groups.google.com/group/python_inside_maya
>>> change your subscription settings: 
>>> http://groups.google.com/group/python_inside_maya/subscribe
>> 
>> -- 
>> view archives: http://groups.google.com/group/python_inside_maya
>> change your subscription settings: 
>> http://groups.google.com/group/python_inside_maya/subscribe
> 
> -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to