I'm having a difficult time getting the 'Exit' button to be on the left-hand side of its frame rather than at the center. Anyone have suggestions? Thanks.
#!/usr/bin/perl -w use strict; use Tk; my $window_title = 'window title'; my $overview_message = "A message that is fairly long for this window\n"; my $mw = MainWindow->new; $mw->title( $window_title ); my $fA = $mw->Frame->pack(-side => 'bottom', ); $fA->Button( -text => 'Exit', -command => sub { exit; }, )->pack( -fill => 'both', -side => 'left', -anchor => 'w', ); my $fB = $mw->Frame->pack(-side => 'top'); my $user_font_choice = 'arial 10 bold'; my @listbox_items = split /\n/, $overview_message; my $listbox = $fB->Scrolled( "Listbox", -scrollbars => 'onoe', # 'onoe': optional north, east -font => $user_font_choice, -selectmode => 'single', -height => scalar @listbox_items, -width => 0, )->pack( -side => 'top', -fill => 'both', -expand => 1 ); $listbox->insert( 'end', @listbox_items ); MainLoop();

In reply to Get a Tk Button to align left in a frame by ff

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.