GNU bug report logs - #57379
GUI toolkit for Guile 3.0?

Previous Next

Package: guile;

Reported by: Lee Thomas <leet22303be <at> gmail.com>

Date: Wed, 24 Aug 2022 11:34:02 UTC

Severity: normal

Full log


Message #50 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Lee Thomas <leet22303be <at> gmail.com>
Cc: Jessica Tallon <tsyesika <at> tsyesika.se>, bug-guile <at> gnu.org,
 57379 <at> debbugs.gnu.org, David Pirotte <david <at> altosw.be>
Subject: Re: bug#57379: GUI toolkit for Guile 3.0?
Date: Sat, 27 Aug 2022 10:30:24 +0200
Hi,

Lee Thomas <leet22303be <at> gmail.com> 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 <at> 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 <at> 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




This bug report was last modified 2 years and 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.