Displaying X11 on Tk
Martin v. Loewis
martin at v.loewis.de
Thu Jan 3 21:19:24 EST 2002
navead at hotmail.com (navead) writes:
> Hi, I currently have a program which is written in python using Tk,
> and also I have a program written in C/C++ which uses X11, what I
> want to do is in the C program rather than display to X11, I would
> like to have it display on my Tk winddow... I am thinking I probably
> have to write a wrapper for the Xlib, so that it calls Tk functions,
> but this can be a hassle.
Not at all. Create a Toplevel or Frame widget with the container=1
resource, then use winfo_id to find out the Window ID of the
window. Pass that ID to your C++ program, and give the Window ID to
XCreateWindow.
If you want to have it the other way around (i.e. Tk embedding itself
into some other application), create a Toplevel widget with the
use=WindowID resource.
HTH,
Martin
More information about the Python-list
mailing list