From: Kevin A. <al...@se...> - 2001-10-18 17:31:06
|
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 emails. 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 widget types are currently supported. The are defined in widget.py and the wxPython control they are based on is in parenthesis (): BitmapCanvas Provides a buffered bitmap. There is no direct equivelant in wxPython. Button (wxButton) CheckBox (wxCheckBox) Choice (wxChoice) Image (wxStaticBitmap) ImageButton (wxBitmapButton) List (wxListBox) PasswordField (wxTextCtrl) RadioGroup (wxRadioBox) Slider (wxSlider) StaticLine (wxStaticLine) StaticText (wxStaticText) TextArea (wxTextCtrl) TextField (wxTextCtrl) The following events are automatically bound and available for each widget: gainFocus loseFocus mouseContextDoubleClick mouseContextDown mouseContextUp mouseDoubleClick mouseDown mouseDrag mouseEnter mouseLeave mouseMiddleDoubleClick mouseMiddleDown mouseMiddleUp mouseMove mouseUp There are additional events such as 'mouseClick', 'keyPress', etc. that are specific to particular widgets. The complete list is available in spec.py. The following attributes are available for each widget. 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 widgets. The attributes can be defined in the resource file as well as in user code. PythonCard uses dot notation for widgets, rather than get/set methods. Here is an example: self.components.field1.text = 'bob' txt = self.components.field1.text Helper classes for widgets: Bitmap (wxBitmap) - defined in graphic.py supported formats: BMP, GIF, JPG/JPEG, PCX, PNG, PNM, TIF/TIFF, XBM, and XPM also supports translation to/from Python Imaging Library (PIL) format Font (wxFont) - defined in font.py In some case, the helper classes and widgets provide extra functionality over their wxPython counterparts. Automatic binding of events and simplifed initialization are the most obvious. ka |