Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
where is output

Posted by ysrise (ysrise), 18 August 2004
I wrote a very simple tcl program.

#!/usr/bin/tcl
set foo "john"
puts "Hi my name is $foo"

I run it under Windows 2000 using the command window. But there was no outputs showed on the window. It just poped out a tk window and finished.  

Does anyone know why?

Thanks a lot.

Posted by admin (Graham Ellis), 19 August 2004
Sounds like you're running under wish (i.e. tcl/tk) if a Tk window popped up.  The #! line isn't doing anything (and is misleading). Try running under Tcl rather that Tk ... if you have to run under Tk, try creating a label and packing it.  Even under Tk, something odd is going on as in wish it should stick within the main application loop.

Dunno where your output is going .... if you're running under wish and/or your program is termining early (which ity might be, but I can't tell from what information I have) there's a chance that your output is correctky routed but it's buffered by Tcl and the buffer didn't get flushed to the output before the program terminated.  

Next stage?   Have a look at the thoughts above, modify what you're doing, experiement to find which of the suggestions may or may not be correct.  

Posted by ysrise (ysrise), 19 August 2004
Thank you for replying.

I added a line code

flush stdout

after my program, still there is no output.

But I don't know how to make my program run under tcl instead of tk.
Can a tcl program run under tcl and tk at a same time?

Thank you.

Posted by admin (Graham Ellis), 19 August 2004
OK ... let's take a step back here. Do you need a GUI (Graphic User interface - buttons, text boxes, etc in their own window) or do you want to have something that's purely command line?



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho