# Framework Overview - Components

Updated: March 31, 2006 for release 0.8.2

I'll try and outline the current state of the framework in order to foster discussion. I'm going to break up the description into several sections. I'm not going to describe every method and attribute since I would just end up repeating what is in the source code. These descriptions can also serve as documentation.

The following component types are currently supported. The are defined in the PythonCard components directory. The wxPython control they are based on is in parenthesis ():

      BitmapCanvas
        Provides a buffered bitmap. There is no direct equivelant in wxPython.
      Button          (wx.Button)
      Calendar        (wx.Calendar)
      CheckBox        (wx.CheckBox)
      Choice          (wx.Choice)
      CodeEditor      (wx.stc.StyledTextCtrl)
      ComboBox        (wx.ComboBox)
      Gauge           (wx.Gauge)
      Grid            (wx.Grid)
      HtmlWindow      (wx.HtmlWindow)
      IEHtmlWindow    (wx.lib.iewin.IEHtmlWindow - Windows-only)
      Image           (wx.StaticBitmap)
      ImageButton     (wx.BitmapButton)
      List            (wx.ListBox)
      MultiColumnList (wx.ListCtrl)
      Notebook (wx.Notebook)
      PasswordField   (wx.TextCtrl)
      RadioGroup      (wx.RadioBox)
      Slider          (wx.Slider)
      Spinner         (wx.Spinner)
      StaticBox       (wx.StaticBox)
      StaticLine      (wx.StaticLine)
      StaticText      (wx.StaticText)
      TextArea        (wx.TextCtrl)
      TextField       (wx.TextCtrl)
      ToggleButton    (wx.ToggleButton)
      Tree            (wx.TreeCtrl)

The following events are automatically bound and available for each component:

      gainFocus
      loseFocus
      mouseContextDoubleClick
      mouseContextDown
      mouseContextUp
      mouseDoubleClick
      mouseDown
      mouseDrag
      mouseEnter
      mouseLeave
      mouseMiddleDoubleClick
      mouseMiddleDown
      mouseMiddleUp
      mouseMove
      mouseUp
      timer

There are additional events such as `mouseClick`, `closeField`, `keyPress`, etc. that are specific to particular components, which you'll find defined in the individual component modules. The following attributes are available for each component.

        backgroundColor
            color: tuple (r, g, b), "named color", or hex color string "#FF00FF"
            color is always returned as an rgb tuple
        command
            string
        enabled
            boolean
        font
            Font
        foregroundColor
            color: tuple (r, g, b), "named color", or hex color string "#FF00FF"
            color is always returned as an rgb tuple
        name    (mandatory, read-only)
            string
        position
            tuple (x, y)
               specifying -1 for either x or y will use the default x or y position
        size
            tuple (width, height)
               specifying -1 for either width or height will use the default
               width or height
        toolTip
            string
        visible
            boolean

Additional attributes such as `label` are defined for some components. The attributes can be defined in the resource file as well as in user code. PythonCard uses dot notation for components, rather than get/set methods. Here is an example:

      self.components.field1.text = 'bob'
      txt = self.components.field1.text

Helper classes for components:

      Bitmap         (wx.Bitmap) - defined in graphic.py
        supported formats:
        BMP, GIF, JPEG, PCX, PICT, PNG, PNM, TIFF, XBM, and XPM
        also supports translation to/from Python Imaging Library (PIL) format,
        and NumPy arrays to bitmap.
      Font           (wx.Font)   - defined in font.py

In some case, the helper classes and components provide extra functionality over their wxPython counterparts. Automatic binding of events and simplifed initialization are the most obvious.

| General Concepts and Limitations | Components | Dialogs | Events and Handlers | Menus | Resource Files | Runtime Tools

$Revision: 1.4 $ : $Author: alextweedly $ : Last updated $Date: 2006/04/06 11:00:26 $