Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tk interface for interactive command line program

Status
Not open for further replies.

Myster

IS-IT--Management
Feb 16, 2005
18
DE
Can someone tell me, is it possible to use expect and/or file handles to execute a command line based sub-program, such that whenever the sub-program needs user input, it can be entered in a pop-up tk entry box, and passed back to the sub program?
 
Yes, it is possible, and using Expect or fileevent handlers would be the way you could accomplish that. In practice, I'd use Expect if possible, as it handles some buffering issues that can otherwise cause serious problems in many cases. The actual implementation is very dependent on what program you're trying to drive using Tcl.

Another approach would be to present the equivalent of a console window for your application. In his book Practical Programming in Tcl and Tk, 3rd ed., Brent Welch builds a simple version of such a console using the Text widget. See pages 327-332 for information. Also, many people use Jeff Hobbs's TkCon application (which is written as a full-featured Tcl shell window for Tcl development and debugging) as a basis for their own interactive consoles. You can download TkCon from the Tcl Developer Xchange, - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top