On 06/12/11 17:17, George Nyoro wrote:
Hey guys,
Really want to thank all of you for helping and bearing with
some of us and the questions we ask around here. I was making a gtk
app sometime ago to copy files from a cd or dvd to my hard disk since
the normal ubuntu copy thing would stop when it encountered some
error, so I needed one that read through errors or none.
For me the normal copy thing is the cp command. It reads
through errors quite happily... I assume you mean one of
the graphical file managers abailable in Ubuntu?
I did in two modules: one having gtk code and the other having the
copy code, then id import the copy code into gtk. The thing is that
when the gtk called the copy module to do so, the process would take
long and so the application would become none responsive.
How are you doing the copy?
If its a long loop or using os.walk() then you need to put it in a
separate thread. Thats probably the best solution. Alternartively invoke
the cp command line and run it in the background(with &), but then you
won;t get suvch good error reports etc...
Otherwise break it into chunks so you only copy a few files at a time
and then return to the GUI. But that will slow the copy process even more!
Can anyone show me how to run the gtk and copy code as separate
processes since this seems to be the only way that the application
graphics wont hang? Thanks in advance.
You don't need separate processes just separate threads.
Check the Python documentation for a threading tutorial.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor