From: David Bailey <david.bailey / technologist.com> Subject: Re: Ruby/Tk (X,Y) Coordinate Question Date: Mon, 3 Apr 2006 02:44:50 +0900 Message-ID: <9fa76478ed00b09cd689769576e87812 / ruby-forum.com> > The root_x and root_y coordinates are relative to the top left corner of > the "screen". Yes. You are right. I talked about error messages which you got. > You know, when I use the "place" geometry manager, the :x and :y objects > are relative to the "parent" widget's origin, but the "event" :x and :y > objects seem to be relative to the "self" widget's origin. Do you > agree? Try this. ---------------------------------------------------------------------------- require 'tk' TkLabel.new(:text=>'click me!', :padx=>10, :pady=>5, :relief=>:raised){ place(:x=>30, :y=>50) bind('1', proc{|x, y| p info = self.place_info p [[x, y], [info['x'], info['y']], [info['x'] + x, info['y'] + y]] }, '%x %y') } Tk.mainloop ---------------------------------------------------------------------------- -- Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)