pythongtkgobject-introspection

How does one call `gdk_frame_clock_get_refresh_info` from Python


While trying to use GTK 3 frame clock in a Python 3 script, I discovered that I don't understand how to invoke the equivalent of gdk_frame_clock_get_refresh_info(). I have first tried the obvious, to call the get_refresh_info() method on the object returned by get_frame_clock():

from gi.repository import Gtk as gtk, GLib as glib

w = gtk.Window()
w.show()
glib.idle_add(lambda: print(w.get_frame_clock().get_refresh_info()))
gtk.main()

That fails with:

TypeError: Gdk.FrameClock.get_refresh_info() takes exactly 4 arguments (1 given)

The C function indeed takes four arguments, but the last two are pointers to gint64. In the Python version the function raises type errors when called with anything except three numbers. When invoked with three numbers, the whole process crashes with a segmentation fault.

Is this a bug in GDK's introspection specs for gdk_frame_clock_get_refresh_info? Is there a workaround, or a different way to obtain the refresh interval?


Solution

  • This is a bug in the gobject-introspection binding specs. A proper bug report has been filed and is being worked on here.