Re: GNU G-Golf 0.8.0-rc-3 available for testing

David Pirotte <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <20240506223903.4651070a@tintin>
Hi Florian,

> ...
> pygobject GTK3 examples are working.  I will experiment and try to
> write Vala/C code that breaks now.

I thought they had Gtk-4 examples as well. But anyway, I cooked a
pygobject version of this drawing-widget example, attached.

Could you:

	install pygobject
	[ run its test-suite ?		- it used to fail, in Guix

Drop this example somewhere:

	chmod a+x drawing-widget.py
	./drawing-widget.py

Thanks,
David
drawing-widget.py (text/x-python, 1.6 KB)
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
 
import gi
gi.require_version("Gtk", "4.0")
 
from gi.repository import Gtk, Gdk, Graphene
 
class DrawingWidget(Gtk.Widget):
    def do_snapshot(self, snapshot):
        width = self.get_width() / 2
        height = self.get_height() / 2
        color = Gdk.RGBA()
        
        color.parse("rgba(237, 20, 20, 1.0)")
        snapshot.append_color(
          color,
          # Gdk.RGBA(red=0.18, green=0.8, blue=0.44, alpha=1.0),
          Graphene.Rect.alloc().init(0, 0, width, height)
        )
        
        color.parse("rgba(46, 204, 112, 1.0)")
        snapshot.append_color(
          color,
          # Gdk.RGBA(red=0.18, green=0.8, blue=0.44, alpha=1.0),
          Graphene.Rect.alloc().init(width, 0, width, height)
        )
        
        color.parse("rgba(252, 189, 74, 1.0)")
        snapshot.append_color(
          color,
          # Gdk.RGBA(red=0.18, green=0.8, blue=0.44, alpha=1.0),
          Graphene.Rect.alloc().init(0, height, width, height)
        )
        
        color.parse("rgba(41, 127, 186, 1.0)")
        snapshot.append_color(
          color,
          # Gdk.RGBA(red=0.18, green=0.8, blue=0.44, alpha=1.0),
          Graphene.Rect.alloc().init(width, height, width, height)
        )

def on_activate(app):
    window = Gtk.ApplicationWindow(
        title="Drawing Widget",
        default_width=320,
        default_height=320,
        application=app,
        child=DrawingWidget(hexpand=True, vexpand=True)
    )
    window.present()
 
app = Gtk.Application(application_id='com.example.App')
app.connect('activate', on_activate)
app.run(None)
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEhCJlRZtBM3furJHe83T9k6MFetcFAmY5hjcACgkQ83T9k6MF
etfzawf/YBccg4frIm4uswaYwxDh3f+pQ8TKu/snLnz/xt1fAvwn0bMdM8PYbnS6
/kqF+6v6miM3LQalc35R4jsATWU8z+UfQD+Yo2PawMAxrHhaiWcSxhXAMX9vz5ax
FNLNprBy1e9KQsgVTGQIWQzQ4n/vh+IF41665Yxc2i3gBGiVfKRoV8SS44UhAuvl
tbbNCBy1XGl2q2Im/dJPaVGKcRwEUdMQsLuYOMcMgo5tp3GUgaurfLvYGTiXWerU
vcIYmCirQaBmS1qxrPzRZXXXyNRYXtQVnDUyHIStzdC0/EEaZ1B/DgxWTp38ctWZ
wSVnazfz1/megiXgjaDLfA3U36lMvg==
=//1b
-----END PGP SIGNATURE-----
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.