Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Starting from an example off the web, I want to add these two lines so that they are left justified and vertical to each other. I've missed something. Attached is the complete program - I am just curious on how to fix the "Model File" and the "Range File" widgets. I know there are other issues...

#!/usr/bin/perl -w use Tk; use strict; # ********************** # Main() # ********************** my( $entry, $filename, $output, ); my $ver = "1.0.0"; my $mw = MainWindow->new; $mw->geometry("500x600"); $mw->title("GUI 6"); my $main_menu = $mw->Menu(); $mw->configure(-menu => $main_menu); # give the user a way to exit the script my $file_menu = $main_menu->cascade(-label=>" ", -underline => 0, -tea +roff=>0); $file_menu->command(-label=>"Exit", -underline=>0, -command => sub{exi +t}); # everyone needs a little help my $help_menu = $main_menu->cascade(-label => "Help", -underline => 0, + -tearoff => 0); $help_menu->command(-label => "Version", -underline => 0, -command => sub{$mw->messageBox(-message => "Versi +on: $ver", -type => "ok")}); $help_menu->command(-label => "About Program", -underline => 0, -comma +nd => \&show_about); my $pet_info_frame = $mw->Frame()->pack(-side => "top"); $pet_info_frame->Label(-text => "View?")->pack(-side => "top"); my $chk1 = "no"; my $chk2 = "no"; my $pet1_chk = $pet_info_frame->Checkbutton(-text => "Show All", -variable => \$chk1, -onvalue => "yes", -offvalue => "no")->pack(- +side => "right"); my $pet2_chk = $pet_info_frame->Checkbutton(-text => "Show Only Differ +ences", -variable => \$chk1, -onvalue => "yes", -offvalue => "no")->pack(- +side => "right"); my $model_info = $mw->Frame()->pack(-side => "left"); $model_info->Label(-text => "Model File : ")->pack(-side => "left"); my $model_info_frame = $mw->Frame()->pack(-side => "left"); my $entry1 = $model_info_frame->Entry( -width => 60, -textvariable => \$filename )->grid( $mw->Button( -text => "...", -command => sub { $filename = $mw->getOpenFile(-title => 'File Browser'); } ), ); $model_info = $mw->Frame()->pack(-side => "left"); my $range_info = $mw->Frame()->pack(-side => "left"); $range_info->Label(-text => "Range File : ")->pack(-side => "left"); my $range_info_frame = $mw->Frame()->pack(-side => "left"); my $entry2 = $range_info_frame->Entry( -width => 60, -textvariable => \$filename )->grid( $mw->Button( -text => "...", -command => sub { $filename = $mw->getOpenFile(-title => 'File Browser'); } ), ); my $button_frame = $mw->Frame()->pack(-side => "bottom"); $button_frame->Button(-text => "Ok", -command => \&update_output)->pac +k(); #my $output_frame = $mw->Frame()->pack(-side => "bottom"); #my $output_scroll = $output_frame->Scrollbar(); #my $output_text = $output_frame->Text(-yscrollcommand => ['set', $out +put_scroll]); #$output_scroll->configure(-command => ['yview', $output_text]); #$output_scroll->pack(-side => "bottom", -expand => "no", -fill => "y" +); #$output_text->pack(); sub update_output { if ( $chk1 eq "yes" ) { $output = "$output\nShow All"; } if ( $chk2 eq "yes" ) { $output = "$output\nShow Only Differences"; +} #$output_text->delete('0.0', 'end'); #$output_text->insert("end", $output); } sub show_about { my $help_win = $mw->Toplevel; $help_win->geometry("300x50"); $help_win->title("About Program"); my $help_msg = "This help page is an example of using multiple windo +ws."; $help_win->Label(-text => $help_msg)->pack(); $help_win->Button(-text => "Ok", -command => [$help_win => 'destroy' +])->pack(); } MainLoop;

Any help appreciated. Thanks in advance.


In reply to problems with frame widgets of tk by gibsonca

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-19 19:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found