Next: Handling Tk Events
Up: Event Handling
Previous: Tk as the
This approach should be used if there is more interaction
between the graphical interface and Prolog execution,
if Prolog has to stop sometimes, handle events and then continue,
or if we simply prefer to handle events in Prolog.
In this case, the Prolog program is the client, Prolog top-level
loop might be active all the time, and Tk events have
to be polled and processed while a Prolog program executes.
The primitives to be used:
- Tcl/Tk is started using e.g. tk([]),
no startup file is specified.
When the initialisation is finished and the Tk main window is displayed,
the control returns back to Prolog.
- tcl/1,2,3 to call Tcl from Prolog
- Prolog predicates are never called from Tcl/Tk,
prolog
and call_prolog
are not used.
- Data can be passed from and to Prolog with
the tcl/3
predicate or using the Prolog graphics
event mechanism (see below), executing prolog_event
in Tcl.
It is important to keep in mind that if a Tcl/Tk
procedure is being called from Prolog, it cannot call back Prolog
to obtain some Prolog data.
All data needed in the Tcl/Tk procedure must be passed to it
as arguments.
Next: Handling Tk Events
Up: Event Handling
Previous: Tk as the
Micha Meier
Tue Jul 2 09:49:39 MET DST 1996