40.6.3 Predicates for Prolog to Interact with Tcl Interpreters with Tk Extensions

tk_new(+Options, -Interp)
Create a Tcl interpreter with Tk extensions.

Options should be a list of options described following:

This allows Tk events to be handled while Prolog is waiting for terminal input; for example, while the Prolog system is waiting for input at the Prolog prompt. Without this option, Tk events are not serviced while the Prolog system is waiting for terminal input.
Please note: This option is not currently supported under Windows.

This gives the main window a title ApplicationName. This name is also used for communicating between Tcl/Tk applications via the Tcl send command.
(This is X windows specific.) Gives the name of the screen on which to create the main window. If this is not given, the default display is determined by the DISPLAY environment variable.

Passes control to Tk to handle a single event before passing control back to Prolog. The type of events handled is passed through the ListOrBitMask variable. As indicated, this is either a list of atoms that are event types, or a bit mask as specified in the Tcl/Tk documentation. (The bit mask should be avoided for portability between Tcl/Tk versions.)

The ListOrBitMask list can contain the following atoms:

don't wait for new events, process only those that are ready
process window events
process file events
process timer events
process Tk_DoWhenIdle events
process any event

Calling tk_do_one_event/0 is equivalent to a call to tk_do_one_event/1 with all flags set. If the tk_dont_wait flag is set and there is no event to handle, the call will fail.

tk_next_event(+TclInterpreter, -Event)
tk_next_event(+ListOrBitMask, +TclInterpreter, -Event)
These predicates are similar to tk_do_one_event/[0,1] except that they processes Tk events until is at least one Prolog event happens, when they succeed binding Event to the first term on the Prolog event queue associated with the interpreter TclInterpreter.

Pass control to Tk until all windows in all Tcl/Tk interpreters are gone.

tk_main_window(+TclInterpreter, -TkWindow)
Return in TkWindow a reference to the main window of a Tcl/Tk interpreter with handle passed in TclInterpreter.

Destroy a window or widget.

Force display of a window or widget.

Return in NumberOfWindows the total number of Tk main windows existing in the system.