use strict; use Tk; use Tk::Pane; my $textVariable = "my text"; my $mw = MainWindow->new; my $frame = $mw->Frame()->pack(-side => 'top', -expand => 1, -fill => 'x'); $frame->Label(-text => "My Label", -anchor => 'w', -width => 10)->pack(-ipady => 1, -side => 'left'); my $entry = $frame->Entry(-textvariable => \$textVariable, -width => 40)->pack(-side => 'left'); $frame->DropSite(-dropcommand => [\&AcceptDrop, $frame], -droptypes => ('Win32')); MainLoop; sub AcceptDrop { my ($widget, $selection) = @_; my $filename; $filename = $widget->SelectionGet(-selection => $selection, 'STRING'); $textVariable = $filename; }