468,512 Members | 1,628 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Embedding a Tkinter widget inside a PyGtk HMI


I am trying to embed a Tkinter widget (TkZinc, http://www.tkzinc.org)
inside a PyGtk HMI.

A guru gave me this advice: "I think you can do some magic using the XID
of the Tkinter widget's window to produce a GdkWindow"

I wrote this little program, which gets the XID of the Tkinter window
and uses it to create a gtk.gdk.Window.
However, I was unable to find any example of embedding a gtk.gdk.Window
inside a classik gtk.Window. I can't believe it has never been done
before and I was astonished to see the low number of results when typing
"gtk.gdk.window_foreign_new" in Google.

Is this the correct way to do this? Should I use Plugs and Sockets,
instead (the documentation is not clear about this and I will update it
if I find new things)?

Any hint would be appreciated!

Sébastien Aubry

import Tkinter
import gtk
from threading import Thread

def creategtk():
xid_ = t.winfo_id()
print xid_
main = gtk.Window(gtk.WINDOW_TOPLEVEL)
main.set_title(GTK Window")
main.connect("destroy", gtk.main_quit)
foreign = gtk.gdk.window_foreign_new(long(xid_))

t = Tkinter.Tk()
Tkinter.Label(t, text='Tk Label').pack()
Jul 19 '05 #1
0 1362

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mickel Grönroos | last post: by
25 posts views Thread by BJörn Lindqvist | last post: by
reply views Thread by Michele Simionato | last post: by
2 posts views Thread by Tonino | last post: by
reply views Thread by Sebastien Aubry | last post: by
4 posts views Thread by Christopher Subich | last post: by
5 posts views Thread by annagel | last post: by
reply views Thread by John McMoangle | last post: by
reply views Thread by Guilherme Polo | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.