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

Hi all, Tkx is new in ActivePerl 5.10, and I can't find document how to create child widget in Tkx. For example: my $mw = Tkx::widget->new("."); my $frame = $mw->new_labelframe()->g_pack(); Then I need to create a button in frame: my $button = $frame->new_button( -text => "Button"); And there is the error: Can't call method "new_button" without a package or object reference So how to indicate the path name of $frame? Thanks for your help.

Replies are listed 'Best First'.
Re: Tkx: path name of child widget
by hipowls (Curate) on Jan 28, 2008 at 10:11 UTC

    I suggest that you have a look at Writeup Formatting Tips which tells you how to format your questions. The bottom of the preview page has a quick guide to available tags and some handy links.

    You will get a better response if your questions are well presented. At a minimum use <p> </p> pairs for paragraphs and <code> </code> for literal code or data blocks.

    Your problem is this line.

    my $frame = $mw->new_labelframe()->g_pack();
    You are assigning the result of g_pack() to $frame, you need to split it into two lines.
    my $frame = $mw->new_labelframe(); $frame->g_pack(); # Now this works $frame->new_button();