Attachment "script.tcl" to
ticket [1529659f]
added by
sbron
2006-07-28 20:10:20.
# Create a slave interpreter that will act as "the other" wish process
load {} Tk [interp create foo]
# Put something in our main window so it will be visible
grid [label .l -width 40 -height 12]
# Create a container frame and pass the id to the slave interpreter
foo eval [list set id [winfo id [frame .f -container 1]]]
grid .f -row 0 -sticky news
# Create a button that will embed a toplevel in the container frame
foo eval {
pack [button .b -command {toplevel .t -use $id -background #F00} \
-text "Embed toplevel"] -padx 20 -pady 20
}
# Setup an example menu
. configure -menu [menu .menu]
.menu add cascade -label Tools -menu [menu .menu.tools]
.menu.tools add command -label "Show embedded window" -command {grid .f}
.menu.tools add command -label "Hide embedded window" -command {grid remove .f}