From: Hidetoshi NAGAI Date: 2005-07-13T15:49:51+09:00 Subject: Re: Updating GUIs From: Joe Van Dyk Subject: Re: Updating GUIs Date: Wed, 13 Jul 2005 06:18:15 +0900 Message-ID: > I'm doing this on a TkCanvas. Each Player has a different polygon > (each polygon has about 30 points on it or so). The polygons have to > move around on the canvas and rotate depending on which direction they > are going. So, I'm calling a rotate function for every point on every (snip) > poly.coords(coords.collect{|x, y| rotate(deg, x, y, *center)}) How many steps do you need for rotation? If that is integer order, you should create and hide all polygons for all rotate steps at the beginning, and show (move) the one for current degree on each update phase. If you can stop updating widgets (e.g. by your own eventloop with TclTkLib.do_one_event), please stop updating while moving 500 polygons and do update_idletasks after moving all. Probably faster than the normal eventloop. # I found a bug on TclTkLib.do_one_event and fixed it on CVS today. # If you try to use TclTkLib.do_one_event, get the latest tcltklib.c # from CVS. And when an application calls Tcl/Tk interpreter very frequently, the cost for conversion of arguments (Ruby object -> Tcl string) is sometimes too large. In such case, TclTkIp._eval may make the application faster. # However, as you say, TkCanvas may not be proper. ;-) -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)