To start a Tcl interpreter extended with Tk, the tk_new/2
predicate is called from Prolog. It has the following form:
tk_new(+Options, -TclInterpreter)
which returns through the variable TclInterpreter a handle to the
underlying Tcl interpreter. The usual Tcl/Tk window pops up after this
call is made and it is with reference to that window that subsequent
widgets are created. As with the tcl_new/1
predicate, many
Tcl/Tk interpreters may be created from Prolog at the same time through
calls to tk_new/2
.
The Options part of the call is a list of some (or none) of the following elements:
top_level_events
Please note: This option is not currently supported under Windows.
name(
+ApplicationName)
send
command.
(send
is not covered in this document. Please refer to the
Tcl/Tk documentation.)
display(
+Display)
DISPLAY
environment variable.
An example of using tk_new/2
:
| ?- tk_new([top_level_events, name('My SICStus/Tk App')], Tcl).
which creates a Tcl/Tk interpreter, returns a handle to it in the
variable Tcl
and Tk events are serviced while Prolog is waiting
at the Prolog prompt. The window that pops up will have the title
My SICStus/Tk App
.
The reference to a Tcl interpreter returned by a call to tk_new/2
is used in the same way and in the same places as a reference returned
by a call to tcl_new/1
. They are both references to Tcl interpreters.