Hi, Thus spoketh Martin B <spooky...@tbs-software.com> unto us on Thu, 1 Sep 2011 11:18:10 +0200:
> Hi all, > I want to know is my solution is 'clean'. > I need good gui response if cpu is very busy. in this example cpu is > compute my photo images on to low res. > > in next step i need compute md5 sums for each image etc. > Is it good solution write all gui class as Thread or better way is > write only critical cpu code into thread like md5 checksums, resizing > etc. > > in this example i want use slider if cpu is computing, which is work. > thanks for your comments. One thing you should *never* do is to try to handle the gui from a child thread. The Tk gui should always be run from the main program thread and communication between the gui and child threads can be done through a lock like a threading.RLock() or a threading.Condition() ; these allow you to safely update some variables from within the child thread and then query this variables' values from the gui thread (typically with an after () loop). The odd thing about gui and threads is, that it might *seem* to work when you touch your gui from the child thread, but weird, unreproducable things may happen. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. "We have the right to survive!" "Not by killing others." -- Deela and Kirk, "Wink of An Eye", stardate 5710.5 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss