Examples -- X Python Reference Manual

Prev: Callback models Up: Mrm Top: Top

# 6.3. Examples

Four complete examples are presented that demonstrate several different techniques for using UIL with Python.

- The "Simple Button using `AddCallback`" example shows how to use UIL to build a widget hierarchy but use the Python `AddCallback` method to add callbacks to the UIL-created widgets.

- The "Simple Button using `PyEval`" example shows how to use the Mrm-registered function `PyEval()` in place of the Python `AddCallback` method to add callbacks to widgets directly from UIL. This illustrates a powerful feature of the Mrm binding---the ability to connect to predefined Python functions without writing any code.

- The "Simple Button using `PyRegister`" example shows the use of `PyRegister` to declare a Python function to be a Mrm-registered callback function. This capability is useful for prototyping in UIL where the prototype will eventually be ported---the callbacks are migrated from Python code to C or C++, but the UIL remains the same.

- The "Command Line Program Front End" example shows the use of the `MrmNcreateCallback` and the `__widget__` symbol to enter the Python widget objects for widgets created in UIL into a Python symbol dictionary.

Menu

- Simple Button using AddCallback
- Simple Button using PyEval
- Simple Button Using PyRegister
- Command Line Program Front End

Prev: Callback models Up: Mrm Top: Top