next up previous index
Next: Passing Prolog Variables Up: Using Tcl/Tk from Previous: Basic ProTcXl

Calling Tcl from Prolog

 

The simplest predicate which executes a Tcl/Tk command from Prolog is

tcl   Command
where Command is a string or an atom with one or more Tcl/Tk commands. The "Hello World" example in ProTcXl looks as follows:
[eclipse 1]: lib(tk).
/auto/home/scorpio15/eclipse/3.5.2/lib_graphic/tk/../sun4/dirs.pl compiled
  traceable 240 bytes in 0.02 seconds
tk_common.pl compiled traceable 2452 bytes in 0.02 seconds
/usr/local/eclipse/3.5.2/lib_graphic/tk/tk.pl compiled traceable
  4988 bytes in 0.27 seconds

yes.
[eclipse 2]: tk([]).            

yes.
[eclipse 3]: tcl 'button .b -text "Hello World" -command exit; pack .b'.

yes.
[eclipse 4]:

The displayed window is almost identical to those from the wish example, the only difference is that the window title is protcl, which is   the default application name for ProTcXl .





Micha Meier
Tue Jul 2 09:49:39 MET DST 1996