From: Joel VanderWerf Date: 2006-12-20T12:45:32+09:00 Subject: Re: TkCanvas on windows seems slow Hidetoshi NAGAI wrote: > From: Joel VanderWerf > Subject: Re: TkCanvas on windows seems slow > Date: Wed, 13 Dec 2006 02:04:47 +0900 > Message-ID: <457EE11C.2070705@path.berkeley.edu> >> With this workaround the animation runs at the same speed as on linux, >> about 60fps. That's a lot better than the 6 fps without the hack. >> >> I wish I knew whether this was a problem in ruby, tkruby, or windows... > > I cannot understand how to reproduce your trouble. > > # I don't have environment for development on Windows. > # And I'm so busy now. > > Can the following methods help you? > > TclTkLib.set_eventloop_tick > TclTkLib.set_no_event_wait > TclTkLib.set_eventloop_wait > > ( Please see ext/tk/MANUAL_tcltklib.eng on Ruby's source tree. ) Thanks for the reference, I didn't know about those methods. Actually, I changed some other things, and the extra task is no longer necessary. I can get an old version of the project to play with the problem more, but it's not very urgent now. If it becomes a problem again, I'll try these methods. Another thing I found useful (for unrelated reasons) was to change thread priorities. One thread is drawing objects and the other is the mainloop thread. Every object in the animation needs to be redrawn once per unit of time. I was seeing flickering because the mainloop thread was (apparently) swapping buffers while the draw thread was iterating over the objects (that's just my guess). So I set the draw thread priority up during the iteration, and the flicker went away. I'm glad Ruby/Tk works well with threads. It makes life easier! -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407