... use Tkx; ... sub init_gui { $win = Tkx::widget->new('.'); $win->g_wm_geometry('+500+200'); $win->g_wm_title('Tkx wrapper'); $win->g_wm_minsize(400, 200); $win->g_wm_protocol('WM_DELETE_WINDOW', sub { exit; }); $win->g_wm_resizable(0, 0); my $f1 = $win->new_frame(); my $f2 = $win->new_frame(); $t1 = $f1->new_text(); $t1->g_pack(-anchor=>'e', -fill=>'both'); my $b1 = $f2->new_button(-text=>'Browse...', -width=>10, -command=>\&select); $b1->g_pack(-anchor=>'e', -fill=>'both'); $f1->g_grid(-row=>0, -column=>0, -padx=>8, -pady=>4, -sticky=>'n'); $f2->g_grid(-row=>1, -column=>0, -padx=>8, -pady=>4, -sticky=>'n'); return; } ... sub select { my $filename = Tkx::tk___getOpenFile( -defaultextension => '', -initialdir => $path, -title => 'Select file', ); if ($filename) { test_file($filename); } return; } __END__