#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new; $mw->title("Something"); my $but_browse = $mw -> Button(-text=>"BROWSE", -command =>\&load_listbox) -> pack(-side => 'left'); my $lb = $mw->Listbox()->pack( -side => 'left' ); MainLoop; sub load_listbox { my $filepath = $mw->chooseDirectory() or return(); opendir (DIR, $filepath) || die("Cannot open directory"); $lb->delete(0, 'end'); $lb->insert('end', grep { ! -d } readdir DIR); close DIR; print "$filepath\n"; }
In reply to Re: Return value from Button event
by zentara
in thread Return value from Button event
by rookie_monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |