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
#!/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)
pgp20nlm3MJ2Y.pgp
Description: OpenPGP digital signature