Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Usage: init(class) @ GTK

by eoin (Monk)
on Dec 13, 2003 at 20:28 UTC ( #314551=perlquestion: print w/ replies, xml ) Need Help??
eoin has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, I recently read the Perl News article about GTK2 and decided to look into it as I have alwats thought that Tk just didn't look good enough. I went to the GTK2 Win Bin home page and downloaded and installed all the dependecies and file nessicary.
I also found the following code to use as an example
#!/usr/bin/perl use Gtk2; Gtk2->init(\@ARGV); my $window = Gtk2::Window->new('toplevel'); my $button = Gtk2::Button->new_with_label("Hello World"); $window->add($button); Gtk2::GSignal->connect($button,"clicked", sub { Gtk2->quit(); r +eturn 0 }); $window->show_all(); Gtk2->main(); exit 0;
When I run this code I get this error message
Usage: init(class) at gtk_example.pl line 3.
Personally I don't have a clue what this means and I thought that I'd post this here while I keep looking around the docs.
Also I love if any one could point me to a good tutorial for using GTK -perl with windows becuase this is my first ever look at it.
Thanks

All the Best, Eoin...

If everything seems to be going well, you obviously don't know what the hell is going on.

Comment on Usage: init(class) @ GTK
Download Code
Re: Usage: init(class) @ GTK
by tcf22 (Priest) on Dec 13, 2003 at 22:08 UTC
    In the CPAN docs it, the calls it init() without any arguments. Try replacing
    Gtk2->init(\@ARGV);
    with
    Gtk2->init();
    Update: when calling a PACKAGE->method(), the class is passed as the first argument automatically. So that is where Usage: init(class) comes in.

    Example:
    #!/usr/bin/perl use strict; use warnings; Tom->init; package Tom; sub init(){ print "Calling init\n"; print "$_\n" for(@_); } __OUTPUT__ Calling init Tom

    - Tom

      tcf22 is correct. Where is the example you quoted so I can report it to the Gtk2 team if is in the Gtk2 stuff? You can also start Gtk2 with use Gtk2 -init; and then init is called for you.

      --traveler

Re: Usage: init(class) @ GTK
by Aristotle (Chancellor) on Dec 14, 2003 at 17:48 UTC
      Valid point. Sorry about that one.

      Cheers.

      P.s. You don't know how to permanently chage the PATH enviroment variable permenantly on Win2000 do you?

      All the Best, Eoin...

      If everything seems to be going well, you obviously don't know what the hell is going on.

        Don't know if it's the same on Windows 2000 but on XP you can right click on My Computer and select properties, on the bottom of the advanced tab is a button for Environment Variables which allows you to change the path (and others) permanently. If that doesn't work you can search the registry for the current value of your path since it is likely stored there.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://314551]
Approved by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-09-16 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls