From: Joe Van Dyk Date: 2005-07-13T16:23:58+09:00 Subject: Re: Updating GUIs On 7/12/05, Hidetoshi NAGAI wrote: > 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. I'm not sure what you mean by "integer order". In fact, that whole paragraph confused me. :-) > > 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. How can I use TclTklp._eval? > # However, as you say, TkCanvas may not be proper. ;-) Thanks for your help!