Host a Gtk widget inside a Tk frame

Dirk Thierbach dthierbach at gmx.de
Sat Apr 20 08:08:31 EDT 2002


In comp.os.linux.x Phlip <phlip_cpp at yahoo.com> wrote:
> Xists:

> I have this friend who has written a large GUI using only Tkinter.

> Then he discovered a must-have widget. But unfortunately this widget
> binds to Gtk. (The Widget in question is VPython, but that's not
> important right now.)

> My friend thinks the best way would be to extract the X windows ID
> from a Tk Frame, wrap this in some way that Gtk understands, and
> present it to the Gtk control as its parent handle. 

It is possible to do that, either when creating the widget in Gtk,
or even after creation using XReparentWindow. Howover, more natural
and probably also

> But my friend's customers expect a seamless interface.

more to your friend's customers liking, would be to extend Tcl/Tk with
some glue code that links to the widget he wants. Tcl/Tk was *made*
for incorporating C extensions (a fact most people forget).

There is a lot of documentation how to do that; a quick search turns
up for example the "Engineering Guide for the Tcl core implementation
and C-level extensions." by John Ousterhout himself, on 

http://tcl.activestate.com/doc/

- Dirk

[F'up to comp.os.linux.x]



More information about the Python-list mailing list