Re: [gtk-list] Perl/Gtk Documentaion



Levi wrote:
> 
> Is there *any* documentation for Perl/Gtk? I'm spent the last four hours
> trying to learn from example, but the examples in the Gtk/samples
> directory are largely uncommented and those Usage: mesages don't really
> help. Is there some docs or at least some well commented code that I could
> look at? Thanks in advance for any help I get.
> 
Hi, 
Firstly, make sure that you have the latest Perl/Gtk (version 0.6123). 
Older versions have many errors and omissions.

The Perl/Gtk maintainers have started to document the bindings and if you
build Perl/Gtk yourself docs should be produced then. Examples of what is
produced are at
  http://www.lettere.unipd.it/~lupus/perl-gtk-ref.html
    for the reference manual of modules and functions, and
  http://www.lettere.unipd.it/~lupus/perl-gtk-ds.html
    for some data structures and types (currently enumerations and flags).

Since Perl/Gtk mimics the toolkits so regularly, I use the
  Gtk+ documentation    
      gtk-docs-html-1.1.1 IIRC a tar.gz from gtk+ download site

  Gnome documentation   
      /usr/doc/gnome-libs-devel-1.0.8/devel-docs/ in my gnome-libs-devel
      rpm package

  Perl/Gtk distribution .xs files

  If you have the gtk+ sources, there is a lot of information in the .c and
      .h files

All the source files are clearly named but the main confusion is likely
to come from the Perl/Gtk structure which is much more obviously object
oriented. For example, gtk_container_add is bound as Gtk::Container->add()
and this method is inherited by all containers. So, to add a widget to a
TreeItem that inherits as follows

 GtkObject
     +----GtkWidget
           +----GtkContainer
                 +----GtkBin
                       +----GtkItem
                             +----GtkTreeItem

you must get a ref $ti_ref to the TreeItem and then call $ti_ref->add()
rather than gtk_conatiner_add() as you would in C.

The file NOTES in Perl/Gtk also gives some programming guidelines and 
information about Perl/Gtk naming.

If you use Glade (the Gtk+ UI builder) I have written a perl module that
generates Perl/Gtk modules from a Glade project file. You could run my
module on a Glade file and look at the source it generates, it handles
all gtk+ widgets and most Gnome widgets that Glade knows about although
there are still some problems with certain Perl/Gtk bindings

Glade is at 
  http://glade.pn.org 

and my module is at
  http://www.glade.perl.connectfree.co.uk/index.html or
  http://freespace.virgin.net/dermot.musgrove/computers/perl/index.html
although the Virgin site is not reliable :-(

HTH, Dermot



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