Some questions from a newbie



Hi!
I've just begun to use gtk-perl, and I tried write a little piece of code myself, based on the examples found in the tutorial. My question is what on earth could be wrong with the following:

#!/usr/bin/perl -w

use Gtk;
use strict;

set_locale Gtk;
init Gtk;

my $false = 0;
my $true = 1;

my $window;
my $box;


$window=new Gtk::Window( "toplevel" );
$window->set_title( "Ez egy ablak" );
$window->signal_connect( "delete_event", sub { Gtk->exit( 0 ); } );

$box = new Gtk::Hbox( $false, 0 );
$box->border_width( 2 );
$window->add( $box );

$box->show();
$window->show();
main Gtk;
exit( 0 );

When I run it, i get the following error message:

Can't locate object method "new" via package "Gtk::Hbox" (perhaps you forgot to load "Gtk::Hbox"?) at elso.pl line 21.

I've no idea what can be wrong here--if I regard the "arrow" demo in gtkperl-tutorial/src, and comment some lines out, I can get the same code, but for some strange reasons, if i did so, it had worked. Please help!

Thanks a lot! Regards:
Peter





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]