in reply to Re^5: clunky Tk GUI
in thread clunky Tk GUI
Also, how do I keep my hash in order? Tie::IxHash ? Thank you for the help. -honyok#!/usr/bin/perl -w use warnings; use strict; use Tk; use Tk::NoteBook; require Tk::Pane; #use Tie::IxHash; use Tk::LabEntry; my $mw = MainWindow->new; $mw->geometry( "600x500"); $mw->title("Survival Kit"); ###program parameter hash my %tools = ( 'program1' => { 'PARM1' => 1, 'PARM2' => 'n', 'PARM3' => + 'y', 'PARM4' => 'n', 'PARM5' => 'y', 'PARM6' => 'n', 'PARM7' => 'y', + 'PARM8' => 'n', 'PARM9' => 'y', 'PARM10' => 'n' }, 'program2' => { ' +PARM1' => 1, 'PARM2' => 2, 'PARM3' => 3, 'PARM4' => 4, 'PARM5' => 5, +'PARM6' => 6, 'PARM7' => 7, 'PARM8' => 8, 'PARM9' => 9, 'PARM10' => 1 +0 }); + ## create notebook my $book = $mw->NoteBook()->pack(-expand=>1,-fill=>'both'); #####program1####### my $tab_cnt=1; for my $tab (keys %tools){ ##create tab,scroll pane,frames my $tab_tab=$book->add("Sheet $tab_cnt", -label => "$tab")->pack +(-expand=>1,-fill=>'both'); my $tab_spane=$tab_tab->Scrolled('Pane',-background=>'slate grey +')->pack(-expand=>1, -fill=>'both'); my $tab_frame1=$tab_spane->Frame(-background=>'blue')->pack(-sid +e=>'left',-expand=>1,-fill=>'both',-padx=>15); my $tab_frame2=$tab_spane->Frame(-background=>'red')->pack(-side +=>'bottom',-anchor=>'s',-fill=>'x'); $tab_cnt++; #create columns my $tab_column1 = $tab_frame1->Frame()->pack(-side=>'left',-exp +and=>1,-fill=>'both'); my $tab_column2 = $tab_frame2->Frame()->pack(-side=>'right',-ex +pand=>1,-fill=>'both'); ##now fill frames my $parm_cnt=1; print "Processing tool: $tab\n"; foreach my $parm ( keys %{$tools{$tab}}) { print " $parm = $tools{$tab}{$parm}\n"; if ($parm_cnt < 6 ){ my $tab_test=$tab_column1->LabEntry(-label => "$parm=") +; $tab_test->Subwidget('entry')->configure(-textvariable => \$t +ools{$tab}{$parm} ); $tab_test->configure(-labelPack=>[-side=>'left']); $tab_test->pack(-anchor=>'e'); } else { my $tab_test=$tab_column2->LabEntry(-label => "$parm=") +; $tab_test->Subwidget('entry')->configure(-textvariable => \$t +ools{$tab}{$parm} ); $tab_test->configure(-labelPack=>[-side=>'left']); $tab_test->pack(-anchor=>'e'); } $parm_cnt++; } #######run button############# my $run=$tab_tab->Button(-text => "\n $tab \n ", -command +=> \&run,-background=>'slate grey')->pack; } MainLoop; ####################### subs ################################# sub run { #print "Label = Entry" to file #execute program }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: clunky Tk GUI
by zentara (Cardinal) on Jan 27, 2009 at 12:53 UTC | |
by honyok (Sexton) on Jan 27, 2009 at 14:54 UTC |