我正在 Quickly 中创建 Web 浏览器。当我运行我的应用程序(快速运行)时,我遇到了有关 gtk 的错误。没有 WebKit 代码,它就可以运行。抱歉我的英语不好。
Errors:
/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
import gobject._gobject
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type 'PyGtkGenericCellRenderer' is smaller than the parent type's 'GtkCellRenderer' class size
from gtk import _gtk
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata: assertion 'node != NULL' failed
from gtk import _gtk
答案1
您正在混合旧的静态绑定和新的动态绑定。
旧示例:import gtk
,,import gobject
import webkit
新示例:from gi.repository import Gtk
,,from gi.repository import GObject
from gi.repository import WebKit
您的代码移植起来非常简单。更改以下几行:
# Line 16
from gi.repository import WebKit
# Line 35
self.webview = WebKit.WebView()