Re: Is there a way to make 'wish' read standard input?
- From: "R. T. Wurth" <rwurth@xxxxxxx>
- Date: Tue, 28 Nov 2006 16:40:03 GMT
"tclin1998@xxxxxxxxx" <tclin1998@xxxxxxxxx> wrote in
news:1164716759.266593.109720@xxxxxxxxxxxxxxxxxxxxxxxxxxx:
Just to make my question more clear.
The following is a very simple script:
### tt.tcl begin
set a 123
puts $a
### end
On Linux console, I type in
wish tt.tcl
I'll see a window pop up, and the console shows
northstar:/tmp% wish tt.tcl
123
_
However,
I could not get the command prompt % in the console.
Is there a way to get tcl command prompt % in the above scenario ?
Thanks!
-Todd
Assuming a UNIX-ish environment, where you start your script in a shell
window, as you illustrate, you can get a console attached to stdin/stdout
by including in your source file:
package require Tclx;
after 500 {after idle {commandloop -async -interactive on}}
(We really, really wanted absolutely everything else to run
first ahead of this, so we used nested [after]s.)
On a project at a previous employer we had a standard argument parser
that filtered out and dealt with common arguments (standard logging,
etc.), used in all our applications. Among the standard arguments it
accepted was one to start an interactive console in just this way. I
was probably its biggest user because my colleagues didn't really
understand geometry management, so I was the one who had to fix their
resize behavior. Having an interactive console through which I could
introspect the widgets and play with their attributes helped immensely.
In that project the console did not present full interactive behavior,
that is, commands could not be abbreviated (arguments and subcommands
could), and [unknown] did not, as a last resort, attempt to use exec. I
vaguely recall having investigating and discovered that someone had coded
our standard startup to turn tcl_interactive off, which would account for
that behavior. I've never tested commandloop in a wish interpreter that
allowed tcl_interactive to default.
--
Rich Wurth / rwurth@xxxxxxx / Rumson, NJ USA
.
- References:
- Is there a way to make 'wish' read standard input?
- From: tclin1998@xxxxxxxxx
- Re: Is there a way to make 'wish' read standard input?
- From: Aric Bills
- Re: Is there a way to make 'wish' read standard input?
- From: tclin1998@xxxxxxxxx
- Is there a way to make 'wish' read standard input?
- Prev by Date: Scrollbar with multiple "listboxes"
- Next by Date: Re: proc needs to always calculate the following Saturday but fails Nov - Apr
- Previous by thread: Re: Is there a way to make 'wish' read standard input?
- Next by thread: Re: Is there a way to make 'wish' read standard input?
- Index(es):
Relevant Pages
|