Gtk/Perl syntax




Shawn T Amundson <amundson@cs.umn.edu> writes:

> Personally, I prefer the following for perl.  Also, PerlTk is an awesome 
> example of how to use the OO features of perl to their fullest.

Perl/Tk was certainly an inspiration for the way I set things up.
Though I'd like to keep things simpler - Perl/Tk has gotten better
but it still does a whole bunch of of hash thrashing at startup.

IMHO, my Gtk bindings are at least as OO as Perl/Tk. (Though maybe
not as clever.)

I'm ambivalent about exporting - the only thing you gain is one character
(gtk_init instead of Gtk::init). It would allow making Gtk not a
toplevel module though ...

> # The next includes the "add" right along with the 
> # with, defining the parent right away, making use of
> # the OO design a bit more. (This causes significant
> # decrease in code.) 
> $button = $window->button_with_label("Hello World");

This really doesn't make sense in the context of gtk - parenting
is a much more flexible thing in gtk than in Tk. In gtk the
only heirarchy the user sees is that of containment - unlike Tk
where there are two non-identical heirarchies - that of
containment/packing and that of ancestry.

Since containment can be expressed in many ways, (item in a list,
widget in a table, widget in a box, etc...), I think it needs
a separate command from creation - which is no worse than Tk
where you have to pack things afterwards.

Thanks for the comments,
                                        Owen



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