- 空间积分
- 0
- 信誉积分
- 100
- UID
- 20908107
- 阅读权限
- 10
- 积分
- 11
- 帖子
- 8
- 精华
- 0
- 可用积分
- 11
- 专家积分
- 0
- 在线时间
- 125 小时
- 注册时间
- 2009-02-23
- 最后登录
- 2011-11-14
- 帖子
- 8
- 主题
- 3
- 精华
- 0
- 可用积分
- 11
- 专家积分
- 0
- 在线时间
- 125 小时
- 注册时间
- 2009-02-23
- 最后登录
- 2011-11-14
- 论坛徽章:
- 0
|
发表于 2010-10-25 18:29:23
|显示全部楼层
perl中我使用TK模块,想用那个打开路径的命令,如下:
$ent =$frm_dir->Entry(-font => 'arial 10 bold italic',
-textvariable => \$save_path,
-width => 45,
-fg => 'blue',)->pack(@p2);
$but =$frm_dir->Button(-text => "Browse ...",
-font => 'arial 10 bold italic',
-command => sub { dirDialog($mw, $ent)})->pack(@p2);
sub dirDialog {
my $w = shift;
my $ent = shift;
my $dir;
$dir = $w->chooseDirectory;
#$dir = $w->getSaveFile( );
if (defined $dir and $dir ne '') {
$ent->delete(0, 'end');
$ent->insert(0, $dir);
$ent->xview('end');
}
}
1;
我按上面的方法来写,,就提示$ent出错,,不知是啥原因? 还请各位指点下,dirDialog如何使用? |
|