[Tkinter-discuss] Combining Tcl/Tck widgets with a Xll Graphics window
Jeff Epler
jepler at unpythonic.net
Tue Apr 11 14:31:10 CEST 2006
The "frame" widget has this option (from the tk manpage):
Command-Line Name:-container
Database Name: container
Database Class: Container
The value must be a boolean. If true, it means that this window
will be used as a container in which some other application will
be embedded (for example, a Tk toplevel can be embedded using
the -use option). The window will support the appropriate win‐
dow manager protocols for things like geometry requests. The
window should not have any children of its own in this applica‐
tion. This option may not be changed with the configure widget
command.
However, actually using this option seems to lead to focus-related headaches.
Anyhow, here's a program that embeds an ImageMagick "display" into a Tk frame:
#-----------------------------------------------------------------------
import Tkinter, sys, os
t = Tkinter.Tk()
b = Tkinter.Button(text="quit", command=t.destroy)
f = Tkinter.Frame(container=True, width=300, height=300, bg="")
f.pack(side="top")
b.pack(side="top")
os.spawnvp(os.P_NOWAIT, 'display', ['display',
'-window', hex(f.winfo_id()),
'-window_group', hex(f.winfo_id()), sys.argv[1]])
t.mainloop()
#-----------------------------------------------------------------------
Jeff
More information about the Tkinter-discuss
mailing list