Elijah has asked for the wisdom of the Perl Monks concerning the following question:
Filename Type Size Speed Location
#!/usr/bin/perl -w use Tk; use Tk::ROText; use Tk::Photo; use strict; my ($font, $bsize, $size) = ('Garamond', '12', '10'); my ($filename, $artist); my $window = MainWindow->new(); $window->title("viva la fileshare"); $window->minsize(900, 600); my $menuframe = $window->Frame()->pack(-side=>'left', -anchor=>'n', +-fill=>'y'); my $buttonframe = $menuframe->Frame()->pack(-side=>'top', -anchor=>'n' +, -fill=>'none'); my $mframe = $buttonframe->Frame()->pack(-side=>'left', -anchor=> +'n', -fill=>'none'); my $mframe2 = $buttonframe->Frame()->pack(-side=>'left', -anchor=> +'n', -fill=>'none'); my $menudisplay = $menuframe->Frame(-relief=>'sunken', -borderwidth=>5 +, -bg=>'#404040')-> pack(-pady=>5, -padx=>5, -ipady=>5, -ipa +dx=>5, -side=>'top', -anchor=>'n', -fill=>'both', -expand=>1); my $mainframe = $window->Scrolled("ROText", -scrollbars => 'e', -font +=> [$font, $size], -background => 'white')-> pack(-pady=>10, -padx=>10, -ipady=>10, -ipadx +=>10, -side=>'top', -fill=>'both', -expand=>1); my $topframe = $mainframe->Frame(-relief=>'sunken', -borderwidth=>5, - +bg=>'#404040')-> pack(-side=>'top', -anchor=>'n', -fill=>'x' +); my $statusframe = $window->Scrolled("ROText", -scrollbars => 'e', -hei +ght => '8', -font => [$font, $size], -background => 'white')-> pack(-pady=>10, -padx=>10, -ipady=>10, -ipa +dx=>10, -side=>'top', -fill=>'x', -expand=>0); my $controlframe = $window->Frame(-bg=>'#404040')-> pack(-pady =>5, -padx =>5, -ipady =>5, -ipadx =>5, +-side =>'top', -anchor=>'center', -fill =>'both'); my $subCframe = $controlframe->Frame(-bg=>'#404040')-> pack(-pady =>5, -padx =>5, -side =>'top', -anchor=> +'center', -fill =>'none'); $mframe->Label(-text=>"Select Type:", -font => [$font, $bsize])->pack( +-side=>'top', -anchor=>'w'); $mframe->Button(-text=>"Any Type", -width=>'10', -font => [$font, $bsi +ze], -command=>sub {DisplaySearch('any type')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe->Button(-text=>"Images", -width=>'10', -font => [$font, $bsize +], -command=>sub {DisplaySearch('image')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe->Button(-text=>"Documents", -width=>'10', -font => [$font, $bs +ize], -command=>sub {DisplaySearch('documents')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe2->Label(-text=>"", -font => [$font, $bsize])->pack(-side=>'top +', -anchor=>'w'); $mframe2->Button(-text=>"Audio", -width=>'10', -font => [$font, $bsize +], -command=>sub {DisplaySearch('audio')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe2->Button(-text=>"Video", -width=>'10', -font => [$font, $bsize +], -command=>sub {DisplaySearch('video')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe2->Button(-text=>"Programs", -width=>'10', -font => [$font, $bs +ize], -command=>sub {DisplaySearch('programs')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); DisplaySearch('any type'); $subCframe->Button(-text=>"Kill Download", -width=>'20', -font => [$fo +nt, $bsize], -command=>\&kill)-> pack(-side=>'left', -anchor=>'center', -fill=>'none'); $subCframe->Button(-text=>"Find Other Sources", -width=>'20', -font => + [$font, $bsize], -command=>\&sources)-> pack(-side=>'left', -anchor=>'center', -fill=>'none'); $subCframe->Button(-text=>"Clear Inactive", -width=>'20', -font => [$f +ont, $bsize], -command=>\&clear)-> pack(-side=>'left', -anchor=>'center', -fill=>'none'); $topframe->Label(-text=>"File\t\t\t\t\t\t\t\t\t\t\tType\t\tSize\t\t\tS +peed\t\t\tLocation", -font => [$font, $size], -bg=>'#404040', -fg=>'# +FFFFFF')-> pack(-side=>'left', -anchor=>'w', -fill=>'x'); MainLoop; sub DisplaySearch { chomp(my $type = uc(shift)); $menudisplay->destroy(); $menudisplay = $menuframe->Frame(-relief=>'sunken', -borderwidth=>5 +, -bg=>'#404040')-> pack(-pady=>5, -padx=>5, -ipady=>5, -ipa +dx=>5, -side=>'top', -anchor=>'n', -fill=>'both', -expand=>1); $menudisplay->Label(-text=>$type, -font => [$font, 15], -bg=>'#4040 +40', -fg=>'#FFFFFF')->pack(-side=>'top', -anchor=>'center'); $menudisplay->Label(-text=>"Filename:", -font => [$font, $bsize], - +bg=>'#404040', -fg=>'#FFFFFF')->pack(-side=>'top', -anchor=>'w'); $menudisplay->Entry(-textvariable=>\$filename, -font => [$font, $bs +ize], -bg=>'#FFFFFF', -fg=>'#404040')->pack(-side=>'top', -anchor=>'c +enter'); if (lc($type) eq 'audio') { $menudisplay->Label(-text=>"Artist:", -font => [$font, $bsize], +-bg=>'#404040', -fg=>'#FFFFFF')->pack(-side=>'top', -anchor=>'w'); $menudisplay->Entry(-textvariable=>\$artist, -font => [$font, $b +size], -bg=>'#FFFFFF', -fg=>'#404040')->pack(-side=>'top', -anchor=>' +center'); } $menudisplay->Button(-text=>"Search", -width=>'7', -font=>[$font, $ +bsize], -command=> sub {searchTest(lc($type), $filename)})-> pack(-pady=>5, -padx=>5, -side=>'top', -anchor=>'w'); $menudisplay->Label(-text=>"perlSkripts.com", -width=>'17', -font = +> [$font, 15], -bg=>'#404040', -fg=>'#FFFFFF')-> pack(-side=>'bottom', -anchor=>'center'); } sub kill { } sub sources { } sub clear { } sub searchTest { my ($type, $target) = @_; if (defined($type) && defined($target)) { print "Type is: $type -- Filename is: $target\n"; } else { print "Enter a search subject jackass!\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: perl/Tk and expandable widgets
by zentara (Cardinal) on Jun 08, 2005 at 11:19 UTC | |
by hexcoder (Curate) on Jan 18, 2013 at 10:00 UTC | |
by Elijah (Hermit) on Jun 09, 2005 at 18:43 UTC | |
by zentara (Cardinal) on Jun 09, 2005 at 20:25 UTC | |
by joelr (Novice) on Nov 04, 2005 at 01:30 UTC | |
by rcseege (Pilgrim) on Nov 04, 2005 at 03:54 UTC | |
by rcseege (Pilgrim) on Nov 04, 2005 at 03:44 UTC | |
Re: perl/Tk and expandable widgets
by thundergnat (Deacon) on Jun 08, 2005 at 10:53 UTC | |
by Courage (Parson) on Jun 08, 2005 at 16:56 UTC | |
by rcseege (Pilgrim) on Nov 04, 2005 at 03:33 UTC | |
by Courage (Parson) on Nov 04, 2005 at 08:23 UTC |