From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] Limbo Tk FAQ? From: rog@vitanuova.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20010525120255.399BF199ED@mail.cse.psu.edu> Date: Fri, 25 May 2001 13:10:55 +0100 Topicbox-Message-UUID: a819a0b2-eac9-11e9-9e20-41e7f4b1d025 > Tcl with channels would do well, too :-) (Oops, I hope I'm not > speaking through my nose here, I've only given the code a brief > glimpse, looking forward to look at it in more detail later). i added a loadable module for the inferno shell to give shell access to tk; this also includes channels (as they're an inextricable part of the inferno tk interface). some will turn up their noses, but i've found it quite nice for knocking up simple graphical demo scripts written in shell script. part of the reason is that the shell is multi-process, so channels sit quite nicely with it. load tk wid := ${tk window 'Test window'} while {} { tk winctl $wid ${recv $wid} } & the first line loads the tk module; the second creates a new tk window, and returns an identifier for it, which is also the name of a channel on which window events can be received. the third starts a background process looping forever receiving from the channel and processing the event that it got. the only part not familiar from rc is the ${...} notation which yields the result of a loadable-module-defined command (sort of like `{...} but without the uncertainty of the usual stdout tokenization) once you've defined a function to execute tk commands: fn x { tk $wid $* } one can execute tk commands quite simply: x button .b -text {Hello world} -command {send cmd hello, world} x pack .b x update chan cmd tk namechan $wid cmd while {} { echo ${recv cmd} } i guess this feels somewhat like tcl; it's certainly nice for hacking up simple graphical interfaces to shell commands.