[pygtk] Embedding external xwindow apps in top level window
njs at pobox.com
Tue Apr 1 12:35:40 WST 2008
On Fri, Mar 28, 2008 at 11:11:22PM -0700, Newell Jensen wrote:
> Is there a way to embed/nest other xwindow guit apps within a top level
> window in pygtk? I have been searching all over and have not figured out
> how to do this.
The real problem with doing this is that if you don't have some sort
of cooperation from the embedded window, then life is Difficult. For
instance, if you want the embedded window to receive keystroke events,
how are you going to arrange for it to get focus? (Your answer will
involve details of the X core protocol, and the ICCCM window manager
But anyway, there are two basic things you can do:
-- if the app you want to embed is designed to be embedded, you just
need to give it the XID of the window where you want it to live.
Xephyr, for instance, has an argument "-parent", which you would
window = gtk.gdk.Window(myparent, ...)
spawn(["Xephyr", "-parent", str(window.xid)])
-- if you want to just grab some other app's window and jam it into
your app, then you first need to figure out the XID of *that*
window ("xwininfo" will do this, for instance), then do something
win = gtk.gdk.window_foreign_new(the_xid)
But your best bet is still probably to find another approach.
Electrons find their paths in subtle ways.
More information about the pygtk