7.1 Mrm functions and variables

The Motif Resource Manager (Mrm) and the User Interface Language (UIL) provide a convenient, standard interface to many commercial GUI-builders. UIL describes the static initial state of a user interface for a widget based application. A UIL module describes a widget hierarchy, the resources of the widgets in the hierarchy, and the callbacks of those widgets. Mrm provides programmatic access to UIL-module definitions.

One powerful feature provided by this Mrm binding is the ability for an interface designer to create an interface using a GUI-builder, bind the UIL-defined interface to (existing) Python functions, and produce a functional GUI program without having to write code (or, at least, not much). We believe that this capability can be used to quickly prototype applications; and, that use of these prototypes operationally is not out of the question.

The Mrm binding is in module Mrm. As usual, you must import Mrm to use the Mrm functions.

The Mrm module defines the following function:

OpenHierarchy( filename_or_filename_list)
Returns mrm_hierarchy_object. This function corresponds with MrmOpenHierarchy.

This Python function allocates a Mrm ID and opens all the UID files named. A single file name or a list of file names may be passed. This function returns an mrmhierarchyobject that can be used to fetch widget trees from the hierarchy. The function also registers the function PyEval(string) (see below) with Mrm for the hierarchy. The function must be called before calling any other Mrm module function but after calling Xt.Initialize().

Examples of using this function are:

    import Xt, Mrm

    toplev = Xt.Initialize()    # must be called first
    mrm_hier1 = Mrm.OpenHierarchy("file-1.uid")
    mrm_hier2 = Mrm.OpenHierarchy(["file-1.uid","f2.uid"])

A .uid file is the output of the UIL compiler, which is typically invoked:

    uil file-1.uil -o file-1.uid

A Python run-time exception is invoked if the uid file cannot be found.