我试图弄清楚如何从信号处理程序中访问小部件。
我有一个名为“lblVerify”的标签,我只想在单击按钮时将文本更改为“已验证”。我知道我需要使用 Gtk2::Label->set_text 之类的东西,但我不完全确定如何从 on_btnVerify_clicked 函数中访问小部件属性。
#!/usr/bin/perl
use strict;
use warnings;
use Glib qw{ TRUE FALSE };
use Gtk2 '-init';
my $builder;
my $window;
# get a new builder object
$builder = Gtk2::Builder->new();
# load the Gtk File from GLADE
$builder->add_from_file( "testglade.xml" )
or die "Error loading GLADE file";
# create the main window
$window = $builder->get_object( "window1" )
or die "Error while creating Main Window";
# connect the event handlers
$builder->connect_signals( undef );
$window->show_all();
$builder = undef;
Gtk2->main();
exit;
sub on_btnVerify_clicked
{
}