Can't add WebKit.WebView to a Gtk.Window
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| pygobject (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Bug Description
$ python -c "from gi.repository import Gtk,WebKit; w=Gtk.Window(); v=WebKit.WebView(); w.add(v)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/
return info.invoke(*args)
TypeError: argument 1: Must be Gtk.Widget, not WebView
ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: python-gobject 2.28.3-1ubuntu1.1
ProcVersionSign
Uname: Linux 2.6.38-
Architecture: i386
Date: Sun Jun 12 08:12:37 2011
ProcEnviron:
LANGUAGE=en_GB:en
PATH=(custom, user)
LANG=en_US.UTF-8
LC_MESSAGES=
SHELL=/bin/bash
SourcePackage: pygobject
UpgradeStatus: Upgraded to natty on 2011-01-18 (144 days ago)
| Changed in pygobject (Ubuntu): | |
| importance: | Undecided → Low |

I battled the same thing in dmedia for quite a while, and I think the issue was having a mix of Gtk2 and Gtk3 installed, needing to explicitly require the correct versions before importing from gi.repository. Here's an example:
import gi version( 'Gtk', '2.0') version( 'WebKit' , '1.0')
gi.require_
gi.require_
from gi.repository import Gtk, WebKit
I attached the dummy-client script I use in dmedia to automatically run JavaScript unit tests in embedded webkit, so you have a full working example (or at least it's working for me right now).