By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

Embedding a Tkinter widget inside a PyGtk HMI

P: n/a

I am trying to embed a Tkinter widget (TkZinc,
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.