From: Hidetoshi NAGAI Date: 2004-09-15T22:22:02+09:00 Subject: Re: ruby/tk - getting started Hi, From: Martin DeMello Subject: ruby/tk - getting started Date: Wed, 15 Sep 2004 21:19:56 +0900 Message-ID: <5pW1d.419414$M95.315449@pd7tw1no> > on it; the bit I'm stuck at is getting the x,y coordinates of the > mouseclick to be the coordinates on the canvas, rather than on the > canvas display viewport. Probably, TkCanvas#canvasx (or canvasy) method satisfies you. From Tcl/Tk's 'canvas' manual, ----------------------------------------------------------- pathName canvasx screenx ?gridspacing? Given a window x-coordinate in the canvas screenx, this command returns the canvas x-coordinate that is displayed at that location. If gridspacing is specified, then the canvas coordinate is rounded to the nearest multiple of gridspacing units. ----------------------------------------------------------- So, on Ruby/Tk, ".canvasx(screenx, [gridspacing])" will return the value which you want. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)