Re: a question about entry
- From: Chas Owens <alas widomaker com>
- To: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Re: a question about entry
- Date: Mon, 08 Sep 2003 14:30:35 -0400 (EDT)
Quoting ken <x t hua 163 com>:
hello,everyone!I'm new to here,and new to gtk2-perl,too.
would anyone like to give me a example for entry?
I only find the examples for entry in gtk-perl,
and then I change gtk to gtk2,it's not running well.
and the example in the gtk2-perl sourses package only
contain the funtion and main.pl,and i can't understand
the sourses or how to change it to the code which can be
running lonely.
Is something like this what you are looking for?
#!/usr/bin/perl
#warning: untested code
use strict;
use Gtk2;
Gtk2->init;
my $window = Gtk2::Window->new;
my $vbox = Gtk2::VBox->new;
my $entry = Gtk2::Entry->new;
my $button = Gtk2::Button->new('click me');
$window->add($vbox);
$vbox->add($entry);
$vbox->add($button);
$window->signal_connect('destroy' => sub { Gtk2->main_quit });
$window->signal_connect(
'clicked',
sub {
my $text = $entry->get_text;
print "the entry contains: [$text]\n";
}
);
$entry->set_editable(1);
$entry->set_text('Hello World!');
Gtk2->main;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]