I am trying to use Tk module to create a simple GUI. I would like to get the "Save and exit" button to be located at most bottom position in the GUI. When running my code below, the button is somewhere in the middle of the GUI. I have tried with -side option.

use Tk; my $mw = MainWindow->new(-title => 'IP User config form'); my $label2 = $mw->Label(-text => 'Part 1: Mandotory fields filling'); $label2->pack(); my $f1 = $mw->Frame(-borderwidth => 2, -relief => 'groove', -width => +30) ->pack(-side => 'top', -fill => 'both', -expand => 1); my $f2 = $mw->Frame(-borderwidth => 2, -relief => 'groove', -width => +30) ->pack(-side => 'top', -fill => 'both', -expand => 1); $f1->Label(-text => 'Config ID')->grid($f1->Entry(-textvariable => \$d +ss_config_id), $f1->Label(-text => 'Milestone ID'), $f1->Entry(-textvariable => \$milestone_id), -sticky => 'w', -padx => +2, -pady => 5); $f1->Label(-text => 'IPX_FQN')->grid($f1->Entry(-textvariable => \$ipx +_fqn), $f1->Label(-text => 'IPX NEWLINE'), $f1->Entry(-textvariable => \$ipx_new_line), -sticky => 'w', -padx => 2, -pady => 5); $f1->Label(-text => 'IPX consumer groups')->grid($f1->Entry(-textvaria +ble => \$ipx_consumer_grp), $f1->Label(-text => 'IPP Tag'), $f1->Entry(-textvariable => \$ipp_tag), -sticky => 'w', -padx => 2, -pady => 5); $f1->Label(-text => 'Process')->grid($f1->Entry(-textvariable => \$pro +cess), $f1->Label(-text => 'Runset version'), $f1->Entry(-textvariable => \$runset_ver), -sticky => 'w', -padx => 2, -pady => 5); $f1->Label(-text => 'UPF version')->grid($f1->Entry(-textvariable => \ +$upf_ver), $f1->Label(-text => 'Contact (username:contact_type)'), $f1->Entry(-textvariable => \$contact), -sticky => 'w', -padx => 2, -pady => 5); #my $label3 = $mw->Label(-text => 'Release Notes Enabling', -relief=>' +groove')->pack(-fill => 'x', -side => 'bottom'); my $label3 = $mw->Label(-text => 'Release notes'); $label3->pack(); my $values2; my @chk_boxes2 = ( [\$values2->{notes},'Notes'], [\$values2->{issues},'Issues'], [\$values2->{comments},'Comments'], [\$values2->{changes},'Changes'], ); check_box2(\@chk_boxes2); $f2->pack(); my $button = $mw->Button(-text => "Save and exit", -command => \&reFor +m)->grid('-', '-', '-', -pady => 10)->pack(-side=>'bottom'); $f2->pack(); MainLoop; sub check_box2 { my $data = shift; my $index = 0; for my $chk_box ( @{$data} ) { my $column = $index % 2; my $row = int($index/2); my $chk_x = $f2->Checkbutton( -text => $chk_box->[1], -variable => $chk_box->[0] )->grid( -column => $column, -row => $row, -sticky + => 'w'); #$chk_x->select if $index == 0; $index++; } my $chk_x=$f2->pack(-side=>'bottom'); }

In reply to Perl tk module by michael99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.