TF Python Module

The TF Python module lets your python module do useful things with TinyFugue. When using /python or python() module tf is already present in the local namespace, but any /python_load script needs to 'import tf'.

tf.err( text ) - sends text to your screen (tferr stream).

tf.eval( string arg ) - is the same as /eval string arg.

tf.getvar( var, (default ) - gets value of var or default if it's not set.

tf.out( text ) - sends text to your screen (tfout stream).

tf.send( text, (world ) - sends text to world (default current) without worrying about the flag/quoting problems of tf.eval()

tf.tfrc() - returns the file name of the loaded .tfrc file (or empty string if none) - returns the name of the current world or empty string if none.

Arbitrary data from TF: Your program can retrieve any information it needs from TinyFugue by doing the following (for example):
tf.eval( '/test "${world_name}"' )
will return a string containing the name of the current world or:
tf.eval( '/test columns()' )
will return an integer with the number of screen columns. Notice the quoting is slightly depending on what we expect it to return.

See the included tf-lib/ and tf-lib/ for fairly complex examples.

See also: tf python for overall info.

Back to index
Back to tf home page
Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys