Hello,
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("d estroy", gtk.main_quit)
main.realize()
foreign = gtk.gdk.window_ foreign_new(lon g(xid_))
main.show()
gtk.main()
t = Tkinter.Tk()
Tkinter.Label(t , text='Tk Label').pack()
Thread(target=c reategtk).start ()
t.mainloop()