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()
:
在尝试在Python 3脚本中使用GTK 3帧时钟时,我发现我不知道如何调用等效的gdk_frame_clock_clock_get_refresh_info()。我首先尝试了一个显而易见的方法,在get_frame_clock()返回的对象上调用get_refresh_info()方法:
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.
C函数确实有四个参数,但最后两个是指向gint64的指针。在Python版本中,除了三个数字外,当调用任何东西时,该函数都会引发类型错误。当使用三个数字调用时,整个进程会因分割错误而崩溃。
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?
这是GDK的gdk_frame_clock_get_refresh_info内省规范中的一个错误吗?是否有一种解决方案,或者另一种获取刷新间隔的方法?
1 个解决方案
#1
2
This is a bug in the gobject-introspection binding specs. A proper bug report has been filed and is being worked on here.
这是gobject-introspection绑定规范中的一个错误。一个合适的错误报告已经被归档并正在这里工作。
#1
2
This is a bug in the gobject-introspection binding specs. A proper bug report has been filed and is being worked on here.
这是gobject-introspection绑定规范中的一个错误。一个合适的错误报告已经被归档并正在这里工作。