PCB论坛网

 找回密码
 注册
查看: 1073|回复: 6

PERL副程式回存值问题.. 谢谢赐教

[复制链接]
发表于 2005-5-4 15:41:53 | 显示全部楼层 |阅读模式

GENESIS-SCRIPTS中,我用PERL执行副程式.回存GENESIS时....

回贴时值为: TK::Entry=HASH(0x1d80424) 请问为什么呢? 请高手赐教.谢谢

部份程式码 如下:

$mw->title("程式"); $mw->Button(-text => "离开", -command =>sub{exit})->pack(-side =>'bottom'); $mw->Button(-text => "执行", -command =>\&addtxt)->pack(-side =>'bottom');

$e1=$mw->Entry(-textvariable=>$e1)->pack(-side =>'bottom');

MainLoop;

sub addtxt { $f->COM(add_text, attributes => "no", type => string, x =>1, y =>1, text => $e1, x_size => 0.1, y_size => 0.1, w_factor => 0.5, polarity => positive, angle => 0, mirror => "no", fontname => standard, ver => 1); exit; }

回复

使用道具 举报

发表于 2005-5-5 00:05:30 | 显示全部楼层
以下是引用justwin在2005-5-4 15:41:53的发言:

GENESIS-SCRIPTS中,我用PERL执行副程式.回存GENESIS时....

回贴时值为: TK::Entry=HASH(0x1d80424) 请问为什么呢? 请高手赐教.谢谢

部份程式码 如下:

$mw->title("程式"); $mw->Button(-text => "离开", -command =>sub{exit})->pack(-side =>'bottom'); $mw->Button(-text => "执行", -command =>\&addtxt)->pack(-side =>'bottom');

$e1=$mw->Entry(-textvariable=>$e1)->pack(-side =>'bottom');

MainLoop;

sub addtxt { $f->COM(add_text, attributes => "no", type => string, x =>1, y =>1, text => $e1, x_size => 0.1, y_size => 0.1, w_factor => 0.5, polarity => positive, angle => 0, mirror => "no", fontname => standard, ver => 1); exit; }

$e1=$mw->Entry(-textvariable=>$e1)->pack(-side =>'bottom'); 既然要宣告$e1为新的变数,那为何文字变数也设为$e1 ???

建议修改如下:

$e1="";

$e2=$mw->Entry(-textvariable=>\$e1)->pack(-side =>'bottom');

还有附程式内要加上防呆!!

if (defined $e1 and $e1 ne "") {

Do something!!

}

副程式回传值建议用return

最后$e2若没用到就不要指定,不然系统会提示你有一个多余变数没用到!!

恭喜你!! 你终于将perl装好了!! [em05]

回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-5 08:27:35 | 显示全部楼层

谢谢 版主赐教. 我的perl装了半年时间才ok.

再次谢谢 mizuno版主.

回复 支持 反对

使用道具 举报

发表于 2005-5-5 08:57:13 | 显示全部楼层
没学过perl还在学shell
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-5-5 16:09:41 | 显示全部楼层

请教版主大人:

my $mw = MainWindow->new;

MainWindow尺寸如何放大呢?因为视示时太小了. 谢谢

回复 支持 反对

使用道具 举报

发表于 2006-3-17 08:40:54 | 显示全部楼层

求助

请教版主一个问题,在GENESIS里用PERL能否也可像用FORM一样,在对GENESIS图型操作的同时也可对PERL的GUI图型操作呢?,谢谢!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-17 15:44:05 | 显示全部楼层

好像可以.需使用perl的图形模组程式.

abcgac兄:可否贴一个form的程式上来呢?请给我参考一下.谢谢您.

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|手机版|PCB设计论坛|EDA论坛|PCB论坛网 ( 沪ICP备05006956号-1 )

GMT+8, 2024-9-22 07:32 , Processed in 0.131506 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表