7.1.2 UIL-declarable functions

There is one UIL-declarable function:

PyEval( string)
This UIL-declarable-function is a Mrm-registered callback function that accepts a string argument that it evaluates in the context of the Python __main__ module. PyEval is for use in UIL, not in Python code. Any non-indented Python code is legal as the string argument; semi-colons can be used to construct a multi-statement argument. Beware of spaces, which are significant. The string argument originates in the uil file as the tag argument to the PyEval function.

An example of using PyEval in UIL code is:

    procedure PyEval(string);
    ...
    XmNactivateCallback = procedure PyEval("MyPrint(g_var)");

Before evaluating the string argument, PyEval adds two special symbols to the namespace of the Python __main__ module. __widget__ is the widget argument to the actual Mrm-registered PyEval callback function wrapped as a Python widget object. __calldata__ is the calldata argument to this function wrapped as a Python callback object.