Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Perl Tk::Pane

by Microcebus (Beadle)
on Jul 08, 2013 at 10:21 UTC ( #1043062=perlquestion: print w/replies, xml ) Need Help??
Microcebus has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I want to create a scrolled main window using Tk::Pane. But I have problems using the geometry manager 'place' to create my widgets. For example in the below code the button does not appear.
use Tk; use Tk::Pane; $main_window=MainWindow->new(-title=>"Program"); $main_window->geometry("800x600"); $main_pane=$main_window->Scrolled('Pane',-scrollbars=>'osoe',-backgrou +nd=>"GhostWhite",-sticky=>'n',-gridded=>'y')->pack(-fill=>'both',-exp +and=>1); $main_pane->Button(-text=>'EXIT',-command=>sub{exit;})->place(-x=>200, +-y=>200); MainLoop;
If I replace ->place(-x=>200,-y=>200) with ->pack() it appears. What am I doing wrong?

Replies are listed 'Best First'.
Re: Perl Tk::Pane (mixing geometry managers pack place)
by Anonymous Monk on Jul 08, 2013 at 13:22 UTC

    What am I doing wrong?

    You're doing something that Tk::Scrolled+Tk::place don't like

    If you want, this arrangement ought to be visible

    my $frame = ... my $button = $frame->...->place my $scrolled = ... $frame->pack( -in => $scrolled, ... );

    Tk really mysterious sometimes, esp managers

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1043062]
Approved by marto
[Corion]: :-D
[stevieb]: I suppose I'll have to delete the 2.36 ver, then re-upload 2.36.1 and 2.36.2, and re-version 2.36 as 2.36.0
[Corion]: stevieb: Naah, I wouldn't delete versions from CPAN. Just up the version to 2.37 resp. 2.37.0 / 2.37.1 etc

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (13)
As of 2017-01-19 15:01 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (170 votes). Check out past polls.