guile-user
[Top][All Lists]
Advanced

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

Re: GtkObject to Guile


From: Andreas Rottmann
Subject: Re: GtkObject to Guile
Date: Fri, 08 Aug 2003 20:41:57 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Bill Schottstaedt <address@hidden> writes:

> José Roberto B. de A. Monteiro wrote:
>
>>Does anyone knows how to use an GtkObject, created in C, in my Guile code?
>>
>>For example, I have a window (GtkWindow) and I have to access it in guile, 
>>with:
>>(gtk-window-set-transient-for dialog window-in-c)
>>
>>Thanks...
>>
>>
> libxm may have what you need
> (ftp://ccrma-ftp.stanford.edu/pub/Lisp/libxm.tar.gz) --
> despite the name it includes some of glib and pango, and all of
> gdk/gtk (version 2).
> There are lots of examples of using it in the snd tarball.
>
As already noted in another mail, guile-gobject also provides bindings
of GDK/GTK+ V2, and has nifty GOOPS-based bindings (see example
below). 

You can grab guile-gobject from
<http://www.nongnu.org/guile-gtk/download>.

Example (from RELEASE-NOTES-0.5.0.txt, shortened):

,----
| (define (app)
|   (let* ((window (make <gtk-window> #:type 'toplevel))
|        (button (make <gtk-button> #:label "Hello, World!")))
| 
|     ;; since window is a container, this generic maps onto the function
|     ;; gtk-container-set-border-width
|     (set-border-width window 10)
| 
|     ;; note that we can set the border width with a gobject property as
|     ;; well:
|     (gobject-set-property window 'border-width 15)
| 
|     ;; (gnome gobject generics), re-exported by (gnome gtk), defines a
|     ;; generic `set' method for gobject-set-property, se we can also do
|     ;; it like this:
|     (set window 'border-width 20)
| 
|     ;; this is much less typing :-)
|     (add window button)
|     
|     ;; see (gnome gobject generics) for a full list of gobject generic
|     ;; functions
|     (connect button 'clicked (lambda (b) (gtk-main-quit)))
| 
|     ;; generic functions for .defs apis are defined in the .defs files,
|     ;; not manually
|     (show-all window)
| 
|     (gtk-main)))
| 
| (app)
`----


-- 
Andreas Rottmann         | address@hidden      | address@hidden | address@hidden
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

This reality is really just a fucked-up dream -- Papa Roach




reply via email to

[Prev in Thread] Current Thread [Next in Thread]