How do I present an open folder selection dialog i

2019-03-31 19:47发布

How do I open folder selection dialog in Perl?

3条回答
我欲成王,谁敢阻挡
2楼-- · 2019-03-31 20:33

Depends on the GUI system you're using, and perhaps the platform. For example, on Windows and using Win32::GUI, you can use GetOpenFileName:

# $main is your main window...
$my_file = $main->GetOpenFileName(
    -title => 'Select a file...',
    -file => 'default.file',
);
查看更多
兄弟一词,经得起流年.
3楼-- · 2019-03-31 20:34

You may want to check out the GUI bindings in wxPerl.

查看更多
看我几分像从前
4楼-- · 2019-03-31 20:37

Most portable (at least compared to others):

use Tk;
my $dir = Tk::MainWindow->new->chooseDirectory;

Of course, if you're actually using Tk in the rest of your program, you should call chooseDirectory on a proper parent widget instead of the one constructed and destructed here.

查看更多
登录 后发表回答