bug#57379: GUI toolkit for Guile 3.0?

Ricardo Wurmus <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
Hi,

Lee Thomas <[email protected]> writes:

> Thank you for responding, Ricardo! I have tried several permutations
> of packages, but currently I have this: […]

This looks all right to me.

I can reproduce this.  I also tried the latest commit of g-golf:

    guix shell --pure guile \
                      guile-g-golf \
                      gtk@4 \
                      coreutils \
                      grep \
               --with-commit=guile-g-golf=b9956e6e4c60d6be5424290e4366f3d3f46b2c31 \
               --cores=1

No difference.

My first guess was that perhaps it gets confused because GTK 3 stuff
also exists on my machine, so I used “--pure” to overwrite the
environment variables.  I also tried “--container” to be sure it doesn’t
accidentally pick up incompatible stuff.

But I can’t get it to work.  It would be helpful if g-golf were to print
more diagnostic information.  As it is I cannot think of anything to
make it work.

I only ever used guile-gi successfully.  This is the Guix shell:

   guix shell --pure guile guile-gi gtk@4 -- guile gi-test.scm

And here’s the code in gi-test.scm:

--8<---------------cut here---------------start------------->8---
(use-modules (gi) (gi repository))

(require "Gio" "2.0")
(require "Gtk" "4.0")

(load-by-name "Gio" "Application") ;activate, run
(load-by-name "Gtk" "Application")
(load-by-name "Gtk" "ApplicationWindow")
(load-by-name "Gtk" "Button")
(load-by-name "Gtk" "Box")
(load-by-name "Gtk" "Window")
(load-by-name "Gtk" "Widget") ;present

(define (print-hello widget)
  (display "Hello World\n"))

(define (on-activate app)
  (let* ((window (make <GtkApplicationWindow>
                   #:application app
                   #:default-height 200
                   #:default-width 200
                   #:title "Window"))
         (box (make <GtkBox>))
         (button (make <GtkButton>
                   #:label "Hello world")))
    (set-child window box)
    (append box button)
    (connect button clicked print-hello)
    (present window)))

(define (main)
  (let ((app (make <GtkApplication> #:application-id "org.gtk.example")))
    (connect app activate on-activate)
    (run app (command-line))))

(main)
--8<---------------cut here---------------end--------------->8---

Clicking the button prints “Hello World” to the terminal.

-- 
Ricardo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.