rookie_monk has asked for the wisdom of the Perl Monks concerning the following question:
my $but = $mw -> Button(-text=>"Find Directory", -command =>\&get_path) -> pack(); # This is what I used, but it is wrong # my($first) = $but; # &LoadListBox($first); sub get_path { my $filepath = $mw->chooseDirectory() or return(); $ent -> delete(0, 'end'); $ent -> insert(0,"$filepath"); return($filepath); } sub LoadListBox($) { my $test = @_; #$lb->delete('0.1', 'end'); # Just use a plain old grep readdir pipeline to create a list of # filenames for our listbox. opendir (DIR, $test) || die("Cannot open directory"); $lb->insert('end', grep { -f $_ && -r $_ } readdir DIR); close DIR; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do you retrieve output from Button widget?
by Anonymous Monk on Aug 25, 2010 at 20:22 UTC | |
by rookie_monk (Novice) on Aug 25, 2010 at 20:41 UTC |