[pygtk] Embedding external xwindow apps in top level window

Newell Jensen pillar2012 at gmail.com
Tue Apr 1 14:14:08 WST 2008

On Mon, Mar 31, 2008 at 9:35 PM, Nathaniel Smith <njs at pobox.com> wrote:

> 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.
> >    Thanks.
> 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
> spec.)
> 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
>     use like:
>        window =3D 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
>     like
>        win =3D gtk.gdk.window_foreign_new(the_xid)
>        win.reparent(my_window)
> But your best bet is still probably to find another approach.
> -- Nathaniel

I was thinking of using DBus so that the apps could talk to each other.  The
apps I want to use are GTK so it looks like sockets and plugs will do the
trick (I haven't actually implemented this though, just going off of what I

> --
> Electrons find their paths in subtle ways.
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

-- =


Before enlightenment, chop wood and carry water
After enlightenment, code and build circuits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080331/170f47e9/at=

More information about the pygtk mailing list