Re: Gtk2->init(\ ARGV);



On Tuesday, January 13, 2004, at 08:02 PM, Andrew Cutler wrote:

I've just started playing with GTK and some of the example code uses
Gtk2->init(\ ARGV);

you've either fetched a really old gtk2-perl (<0.20) or you've found buggy examples. where was the example code?


Can someone please explain what the arguments are supposed to be and
what it does compared to use GTK2 -init; ?

Gtk2->init this is the perl version of gtk_init(). it is bound as a class static method for Gtk2, since it modifies the internal state of the gtk+ library.[1] the perl wrapper is smart enough to find and modify @ARGV for itself, so you pass no arguments to it.

reference docs for gtk_init()
   http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html#gtk-init

reference docs for Gtk2->init
http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/ main.html#boolean_Gtk2_init

since 95% of the time you want Gtk2 initialized in your main program, Gtk2 offers an import argument, "-init", which calls Gtk2->init for you.

  use Gtk2 -init;

is equivalent to

  use Gtk2;
  Gtk2->init;



[1] or because it's "object-oriented", in the buzzword-sense of the term. see the methods versus functions thread for more philosophy on that.

--
"it's hard to be eventful when you have this much style."
   - me, rationalizing yet another night of sitting at home.




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