hi ,getting error like this for the script..
couldn't connect to display ":0" at
/usr/lib/perl5/vendor_perl/5.8.3/i586-linux-thread-multi/Tk/MainWindow.pm
line 55.
MainWindow->new() at ./dialog.pl line 5
please let me know if there are other perl codes for dialog boxes and radio
buttons.
On Thu, Mar 20, 2008 at 5:59 PM, zentara <[EMAIL PROTECTED]> wrote:
> On Wed, 19 Mar 2008 23:15:08 +0530, [EMAIL PROTECTED] (nag) wrote:
>
> >Hi,
> >I'm familiar with dialog command in shell, but i need to have a dialog
> box
> >with radio buttons in perl , please help me
> >
> >-Thanks
> >Nagesh
>
> #!/usr/bin/perl
> use Tk;
> use Tk::DialogBox;
>
> my $mw = MainWindow->new;
>
> my $dialog = $mw->DialogBox(
> -buttons => [qw/Ok Cancel/],
> -title => "Select Value"
> );
>
> my $button = $mw->Button(
> -text => "Get new value...",
> -command => \&getNewValue,
> )->pack(qw/-side left -padx 10/);
>
>
> my $bev = "coffee"; # Starting value
>
> my $coffee = $dialog->Radiobutton (
> -variable => \$bev,
> -text => 'Coffee',
> -value => 'coffee')->pack (-side => 'left');
>
> my $tea = $dialog->Radiobutton (
> -variable => \$bev,
> -text => 'Tea',
> -value => 'tea')->pack (-side => 'left');
>
> my $milk = $dialog->Radiobutton (
> -variable => \$bev,
> -text => 'Milk',
> -value => 'milk')->pack (-side => 'left');
>
>
> MainLoop;
>
> sub getNewValue {
> ## Determine whether or not the user hit "Ok"
> my $button = $dialog->Show();
> if ( $button eq "Ok" ) {
> print "$bev was selected\n";
> }
> }
> __END__
>
>
> zentara
> --
> I'm not really a human, but I play one on earth.
> http://zentara.net/japh.html
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>
--
Thanks
Nagesh