Don't manage to have a working Hdy.Window

Playing with libhandy, I tried the python example in source and the vala example here:

With the python exmaple, if I use Gtk.Window all is fine but with Hdy.Window, I have no round corner as promised. I have no decoration at all and the window can’t be moved.

The vala example uses Hdy.ApplicationWindow and the result is the same without changing anything in the code: no window decoration.

I use gtk-3.24 and libhandy-1.0.3. What am I doing wrong?

Can you provide the source code you are trying to run?


import gi

gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
gi.require_version('Handy', '1')
from gi.repository import Handy
import sys

window = Handy.Window(title = "Keypad Example with Python")
vbox = Gtk.Box(orientation = Gtk.Orientation.VERTICAL)
entry = Gtk.Entry()
keypad = Handy.Keypad()

vbox.add(entry)     # widget to show dialed number

vbox.props.margin = 18
vbox.props.spacing = 18

keypad.set_entry(entry)     # attach the entry widget

window.connect("destroy", Gtk.main_quit)

and the unmodified code here:

You need to call Handy.init() before trying to initialize its types.

Both of those examples are outdated. The demo from my repo was written against 0.81.0 (an alpha version of 1.x, where we experimented with implicit init) and the Python example is from the repo itself and is perpetually outdated and in a need of rework. (the C demo is up to date)

You need to call Hdy.init() in Vala / Handy.init() in Python in:

  • If you have a GApplication, you do it in startup() after chaining up, e.g. like here
  • Otherwise after your gtk_init() call

In future we’ll probably have a GtkApplication subclass that does this automatically among other things. see here for the python demo update.

Thanks, it works.
Building libhandy 1.1, I discovered Hdy.Flap widget, it’s a nice one. Waiting for it to also be supported with gtk4.

It is available in the GTK4 port. :slight_smile: I ported it as soon as it was merged.

Can you point me to this port ? Only found your own fork of libhandy.

Sorry, found it, wasn’t looking at the correct branch :slight_smile:
Thanks for you fast help and you work on libhandy.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.