The predicate
tk(Options)is the basic predicate that initialises a Tcl interpreter and a Tk main window so that Tcl/Tk commands can be executed. Options is a list of options (see tk/1 ), or nil. tk([]) is equivalent to invoking wish without arguments. When tk/1 succeeds, the Tk toplevel window "." is displayed.
The predicate tk_demo/0 will invoke the Tk demonstration suite distributed with Tk. Note that until we exit the demo with the Quit option in the Misc menu, the Prolog top-level loop is not accepting any input. This is one possible way to use Tk in ECLiPSe , however it is also possible to process both graphical input and Prolog queries (see sec. 5.2).
The predicates tclsh/0 and wish/0 can be used to test Tcl/Tk code with ProTcXl commands. They initialise a Tcl interpreter and behave quite like their Tcl/Tk counterparts: they print a prompt, read a command from the user, execute it and print the result:
[eclipse 16]: tclsh. % info globals [tcl_version, argv, argv0, tcl_interactive, auto_path, errorCode, errorInfo, protcl_library, env, tcl_patchLevel, argc, tcl_library] % # ^D typed yes. [eclipse 17]: wish. % info globals [tcl_version, argv, argv0, tcl_interactive, tkPriv.brick:0, tk_library, tk_version, errorCode, auto_path, errorInfo, tk_strictMotif, protcl_library, tkPriv, env, tcl_patchLevel, argc, tk_patchLevel, tcl_library] % # ^D typed yes.