Hi All,
I have to create files based on the ext1 - ext2 and write few lines
of code there. The created file should have to option like like update and
save so that user can edit the file in future.
For this I choose the Radiobatton option of Perl/Tk. Here I am doing a very
silly mistake, and it is just due to little knowlege towards Perl/TK
(started learning Perl/TK for 2 days).
So Request you to let me know where I am doing the mistake.
It will great help, if you help me to overcome this issue.
#!/usr/bin/perl -w
use Tk;
use strict;
our ($filename);
$filename = "DMM";
my $mw = MainWindow -> new;
my $rb_value = "red";
$mw -> configure( -background => $rb_value);
my $val;
foreach ( qw ( ext1 ext2 ext3) ) {
$mw -> Radiobutton ( -text => $_,
-value => $_,
-variable => \$val,
-command => \&set_bg) -> pack (-side => 'left');
}
MainLoop;
sub set_bg {
my $Data = "Hello World";
print " Selcted CPU is : $val\n";
#$mw -> configure ( - background => $rb_value);
$mw -> configure ( -textvariable => $rb_value);
print " File name is : $filename\n";
if ( $rb_value eq "ext1" ) {
$filename = $filename . "\_" . $rb_value;
print " Edited name is : $filename \n";
open ( FILE, $filename ) or die " Can't open the $filename $!";
print FILE $Data;
}
}
/Perl/GUI>perl Radio.pl
Selcted CPU is : ext1
Tk::Error: Can't set -textvariable to `red' for MainWindow=HASH(0x982af0):
unknown option "-textvariable" at
/apps/perl/modules-0812/lib/x86_64-linux-thread-multi/Tk/Configure.pm line
46.
at /apps/perl/modules-0812/lib/x86_64-linux-thread-multi/Tk/Derived.pm line
294
Tk callback for .
Tk::Derived::configure at
/apps/perl/modules-0812/lib/x86_64-linux-thread-multi/Tk/Derived.pm line 306
main::set_bg at Radio.pl line 26
Tk::BackTrace at
/apps/perl/modules-0812/lib/x86_64-linux-thread-multi/Tk.pm line 124
Tk::Derived::configure at
/apps/perl/modules-0812/lib/x86_64-linux-thread-multi/Tk/Derived.pm line 306
main::set_bg at Radio.pl line 26
Tk callback for .radiobutton
Tk::__ANON__ at /apps/perl/modules-0812/lib/x86_64-linux-thread-multi/Tk.pm
line 250
Tk::Radiobutton::Invoke at
/apps/perl/modules-0812/lib/x86_64-linux-thread-multi/Tk/Radiobutton.pm line
42
<Button-1>
(command bound to event)
--
--
Regards,
Mujju
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs