10.38.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:

top_level_events
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.
name(+ApplicationName)
This gives the main window a title ApplicationName. This name is also used for communicating between Tcl/Tk applications via the Tcl send command.
display(+Display)
(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.


tk_do_one_event
tk_do_one_event(+ListOrBitMask)
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:

tk_dont_wait
don't wait for new events, process only those that are ready
tk_x_events
tk_window_events
process window events
tk_file_events
process file events
tk_timer_events
process timer events
tk_idle_events
process Tk_DoWhenIdle events
tk_all_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.


tk_main_loop
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.


tk_destroy_window(+TkWindow)
Destroy a window or widget.


tk_make_window_exist(+TkWindow)
Force display of a window or widget.


tk_num_main_windows(-NumberOfWindows)
Return in NumberOfWindows the total number of Tk main windows existing in the system.

Send feedback on this subject.