Next: Widget Classes and Up: Python Tix User Guide Previous: Tix Commands

# Tix Object Oriented Programming

Tix comes with a simple object oriented programming (OOP) framework, the Tix Intrinsics, for writing mega-widgets. The Tix Intrinsics is not a general purpose OOP system and it does not support some features found in general purpose OOP systems such as [incr Tcl] or Python. However, provides a simple and efficient interface for creating mega-widgets so that you can avoid the complexity and overheads of the general purpose OOP extensions.

The hard thing about programming with mega-widgets is to make sure that each instance you create can handle its own activities. Events must be directed to the right widget, procedures must act on data that is internal to that widget, and users should be able to change the options associated with the widget. For instance, we'll show an arrow widget that needs to know what direction it's pointing; this requires each instance of the widget to have its own variable. Furthermore, each widget must respond properly to changes requested by the application programmer during the program's run.

- Widget Classes and Widget Instances
  - Widget Instances
- Widget Class Declaration
  - Using the tixWidgetClass Command
- Writing Methods
  - Declaring Public Methods
- Standard Initialization Methods
  - The InitWidgetRec Method
- Chaining Methods
  - The ConstructWidget Method
  - The SetBindings Method
- Declaring and Using Variables
  - Initialization of Public Variables
  - Public Variable Configuration Methods