How do I present an open folder selection dialog in Perl?

南笙酒味 提交于 2020-01-01 06:28:46

问题


How do I open folder selection dialog in Perl?


回答1:


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',
);



回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/1871290/how-do-i-present-an-open-folder-selection-dialog-in-perl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!