For instance here is an image box:
box image {
load [file join $::shellbinpath pngext2.so] Pngext2
} takes filename {
if {[catch {out 1 [pngext2:decode file $filename]} result]} {
out 0 error
out 1 $result
return
}
out 0 image
} out 2To use that box I might have something like:box interactor {
#
# This is the init path. It can contain procs and other startup code.
#
package require Tk
load [file join $::shellbinpath megaimagetk.so]
pack [button .b -text {Load image} -command {
out 0 /path/to/somefile.png}]
pack [label .img]
} takes {type data} {
switch -- $type {
error {
tk_messageBox -icon error -message $data
}
image {
set img [image create photo]
megaimage.to.photo $data $img
.img configure -image $img
}
}
} out 1Then I connect the boxes like so:connect interactor 0 image 0 connect image 0 interactor 0 connect image 1 interactor 1 router vwait forever

