http://qs321.pair.com?node_id=471756

beretboy has asked for the wisdom of the Perl Monks concerning the following question:

If I have a function that is being passed a Tk widget object, and only the object, how can I figure out various attributes (height, width, which position its in on the main window grid) about it?


"Sanity is the playground of the unimaginative" -Unknown

Considered: beretboy: "Please Reap. Lo and behold I found the answer within minutes of posting."
Unconsidered: davido: Final vote: (keep/edit/delete) => 20/2/4. Keeps blocked reaping. Others will find node useful.

Replies are listed 'Best First'.
Re: Ascertaining attributes of a Tk object
by beretboy (Chaplain) on Jul 01, 2005 at 15:44 UTC
    This is suprisingly hard to find reading the Tk docs, but very clearly laid out in Chapter 13 of Mastering Perl/Tk:
    $widget->cget(-option)
    Will return the current setting of the option.


    "Sanity is the playground of the unimaginative" -Unknown
Re: Ascertaining attributes of a Tk object
by zentara (Archbishop) on Jul 02, 2005 at 12:18 UTC