Re: How to find out path of widget in TK-like style ?

Slaven Rezic <[email protected]> 20 Jul 2007 02:03:19 +0200
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Joel HATSCH <[email protected]> writes:

[...]
> OK, so here it goes : I did a lot of Tk programming in the past.
> There, when you want to access a widget, you address it using it's
> hierarchical name like .frame1.frame2.mybutton. In ptk however, you
> use variables to store the objects. If you know the parent's
> variable, you can browse through its children to find the given
> widget. However, there doesn't seem to be a function that maps the
> string ".frame1.frame2.mybutton" to the corresponding widget's
> variable.

There is: $mainwindow->Widget($pathname).

For example:

$ perl -MTk -e '$mw=tkinit;warn $mw->Frame->Frame->Label;warn $mw->Widget(".frame.frame.label")'
Tk::Label=HASH(0x9024f8) at -e line 1.
Tk::Label=HASH(0x9024f8) at -e line 1.
 
Regards,
        Slaven

-- 
Slaven Rezic - slaven <at> rezic <dot> de

    tkruler - Perl/Tk program for measuring screen distances
    http://ptktools.sourceforge.net/#tkruler
--++**==--++**==--++**==--++**==--++**==--++**==--++**==
ptk mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/ptk