How to get the position of widget in a toplevel window or root window using Tk

Hi all,

I create a root window and a toplevel window in a small GUI using Tk. I
create several buttons in root window and toplevel window. How
can I get the position of each widget relative to each window: the
buttons in root window relative to root window and buttons in toplevel
buttons relative to toplevel window?

Thanks,

Li CN wrote in post #1158324:
in Tcl you can use winfo:

whish
% winfo geometry .
200x200+100+100
(minitcp) 7 %

They look like these in Ruby:

$button1.winfo_width
$button1.winfo_height

$button1.winfo_x
$button1.winfo_y

$button1.winfo_geometry