vortmax has asked for the wisdom of the Perl Monks concerning the following question:
If I move the contents of the sub out and into the mainloop, it displays as I want it to.use warnings; use strict; use Tk; ### Build Main Window # my $mainWindow = MainWindow->new; $mainWindow->title("BNS Cable Customer Managment"); $mainWindow->geometry("800x600"); ### Build Menu Bar my $mainMenu =$mainWindow -> Menu(); $mainWindow -> configure(-menu => $mainMenu); my $fileM = $mainMenu -> cascade(-label=>"File", -underline=>0, -tearo +ff => 0); my $optsM = $mainMenu -> cascade(-label=>"Options", -underline=>0, -te +aroff => 0); my $modeM = $mainMenu -> cascade(-label=>"Mode", -underline=>0, -tearo +ff => 0); ##File Menu $fileM -> command(-label => "New Property", -underline=>0 ); $fileM -> command(-label => "Logout", -underline=>0 ); $fileM -> separator(); $fileM -> command(-label =>"Exit", -underline => 1, -command => sub { exit } ); ##Options menu $optsM -> command(-label => "Preferences", -underline=>0 ); ##Mode Menu $modeM -> command(-label => "Property Centric", -underline=>0, -command => \&propCen); $modeM -> command(-label => "Task Centric", -underline=>0 ); #### Now the main Content my $content = $mainWindow->Frame; $content->pack(-fill => 'both', -expand => 1, -pady => 10, -padx => 10); MainLoop; sub propCen { $content->packForget; my $propList = $content->Scrolled("Listbox", -scrollbars=>"e", -exportselection => 0, -selectmode => "extended") ->pack( -anchor => 'w', -fill => 'y', -expand => 1); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing TK object into a sub
by zentara (Cardinal) on Jul 16, 2008 at 15:07 UTC | |
by vortmax (Acolyte) on Jul 16, 2008 at 15:19 UTC | |
by zentara (Cardinal) on Jul 16, 2008 at 15:38 UTC | |
by vortmax (Acolyte) on Jul 16, 2008 at 15:54 UTC |