From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Perl Perl Sent: 27 May 2009 15:40 To: perl-win32-users@listserv.activestate.com Subject: Problem iwth perl tk : Creation of file based on options
> 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. Sorry, I didn't understand that. > 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); This is clearly the line that is causing the problem. It is complaining that -textvariable is not a valid configuration option for that widget. As I have no idea what you are trying to do, the best I can say is don't do that. > 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) HTH -- Brian Raven This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs