use Tk; require Tk::LabFrame; use Tk::LabEntry; my $diswindow = MainWindow->new(-title => "Distances...",); $diswindow->minsize(qw(700 100)); $diswindow->maxsize(qw(700 100)); my $colour = 'lightsteelblue'; my $Temp : shared = 20; my $Temp3 : shared = ("\x{00B0}"); $diswindow->configure(-bg => $colour,); # labframe for distances my $f1 = $diswindow->LabFrame(-bg => $colour, -label => "Test distanc +es (in meters) and time taken to travel such at temperature (in \x{00 +B0}C).", -labelside => "acrosstop")->pack(-padx => 5, -pady => 7); # the \x{00B0} in the above prints the "UTF-8/**** encoded degree symb +ol" # check this again because it looks wrong ?!? # Abbrev of celsius is just C ??! # don't want left, rightk top or bottom want "acrosstop" # The acrosstop creates a grooved frame around the central frame and p +uts the label # near the northwest corner such that it appears to ``overwrite'' the +groove. # breakup f1 labframe # my $topframe4u=$f1->Frame(-bg => $colour,)->pack(-side=>'top', -fill +=>'x'); my $leftframe4u=$f1->Frame(-bg => $colour,)->pack(-side=>'left', -fill +=>'y'); my $rightframe4u=$f1->Frame(-bg => $colour,)->pack(-side=>'left', -fil +l=>'y'); my $rightframe4temp=$f1->Frame(-bg => $colour,)->pack(-side=>'left', - +fill=>'y'); my $a_to_b_distance = 343; # # Showing that distance: my $atbdis = $leftframe4u->LabEntry(-bg => $colour, -label => "a to b +distance =", -labelPack => [-side => "left"], -width => 10, -textvari +able => \$a_to_b_distance)->pack(-side => 'left', -padx => 5, -pady => 5); $atbdis->configure(-bg => $colour,); # The distance of $a to $b is then travelled by sound in say $time_a_t +o_b # showing the time: my $time_a_to_b = ($a_to_b_distance / 343 ); my $a_b = ("a to b is then travelled by sound in... "); my $wida = $rightframe4u->Label(-bg => $colour, -width => 49, -text => + $a_b . $time_a_to_b, )->pack(-side => 'left', -padx => 1, -pady => 5 +); # $Temp3 = ("\x{00B0}"); $say1 = ("when the tempreature is "); # showing the temp: my $wid = $rightframe4temp->Label(-bg => $colour, -width => 24, -text +=> $say1 . $Temp . $Temp3, )->pack(-side => 'left', -padx => 1, -pad +y => 5); my $n1 = $diswindow->Button(-text => 'Skin', -command => \&butone, -borderwidth => '0', -bg => $colour, -activebackground => $colour,)->p +ack(-side => 'left', -padx => 1, -pady => 1); # to turn off the windo +w ($noise), etc... but also add something for the display/screen itse +lf. sub butone { @skinframs = ($leftframe4u, $rightframe4u, $rightframe4temp, $f1, $dis +window, # ); ##### $n1 @skinframs[4]->configure(-bg => $diswindow->chooseColor(-initialcolor +=> $colour, -title => "Choose color")); ################# so insteat of $diswindow in the above how would i en +ter @skinframs[0..$#skinframs]; # then output the colour chosen to a file... as of: ### my $infile4ccc = "C:\\Perl\\tk\\prog2\\colour.txt"; # var from + choise should be but in here ??? open(OUTFILEcc, "> $infile4ccc") or die "Can't open colour.txt: $!"; print OUTFILEcc "white"; # instead of white, print to the file t +he chosen colour from the above choosecolor thingy close OUTFILEcc; } MainLoop;
In reply to Re: Adding a Skin to a Tk widget
by Anonymous Monk
in thread Adding a Skin to a Tk widget
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |