Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a Gtk3 Window with a custom input mask, so that the window wouldn't receive any mouse clicks. This is a piece of code that I've came up with:

surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, w , h)
surface_ctx = cairo.Context(surface)
surface_ctx.set_source_rgba(1.0, 1.0, 1.0, 0.0)
reg = Gdk.cairo_region_create_from_surface(surface)

Unfortunately call to Gdk.cairo_region_create_from_surface() fails with this error:

Traceback (most recent call last):
  File "../kazam/frontend/", line 144, in cb_draw reg = Gdk.cairo_region_create_from_surface(surface)
  File "/usr/lib/python2.7/dist-packages/gi/", line 43, in function return info.invoke(*args, **kwargs)
TypeError: Couldn't find conversion for foreign struct 'cairo.Region'

After inspecting Gdk-3.0.gir file I am somewhat baffled. Clearly I am doing something wrong (or there's something wrong with introspection?). Any advice will be appreciated.

share|improve this question
could you paste a complete example? – xubuntix Jan 23 '12 at 12:10 seems to be "fix released, but we're waiting for upstream" – RobotHumans Oct 23 '12 at 20:59

Unfortunately, some Cairo objects are not introspected yet:

If you feel adventurous you can try to add support by yourself. Otherwise you need to find a workaround.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.