You are not logged in.

#1 2011-07-27 19:06:41

demula
Member
From: Spain
Registered: 2011-02-27
Posts: 4
Website

[python3][gtk3] How to get Gdk window from xid?

I'm lost in version 3.. in python2+gdk2 is:

#!/usr/bin/env python2
import gtk

gtk.gdk.window_process_all_updates()
window_xid = 54525964
gdk_window = gtk.gdk.window_foreign_new(window_xid)

which is pretty much straight forward. But then, the horror:

#!/usr/bin/env python3
from gi.repository import xlib
from gi.repository import Gdk
from gi.repository import GdkX11

Gdk.Window.process_all_updates()
xlib_window = "???????"
gdk_display = GdkX11.X11Display.get_default()
gdk_window = GdkX11.X11Window.foreign_new_for_display(gdk_display, xlib_window)

the xlib is killing me.. I'm unable to do anything with it. Has anybody worked with it before??

The documentation I've through several times already is:
http://developer.gnome.org/gdk3/3.0/gdk … or-display
http://tronche.com/gui/x/xlib/

Getting the window from its xid was the fastest way to get a screenshot in python2 I guess I'll have try another way in python3.. any ideas? maybe peek_children from root window??

Last edited by demula (2011-07-27 19:38:19)

Offline

Board footer

Powered by FluxBB