Package wx :: Package lib :: Package agw :: Module shapedbutton :: Class SButton

[frames | no frames]

## Type SButton

    object --+
             |
        Object --+
                 |
        EvtHandler --+
                     |
                Window --+
                         |
                        SButton

Known Subclasses:
  `SBitmapButton`, `SToggleButton`

Method Summary
| ``__init__`(self, parent, id, label, pos, size)` Default class constructor.
| ``AcceptsFocus`(self)` Overridden base class virtual.
| ``ConvertPILToWX`(self, pil, alpha)` Convert PIL image into wx.Image.
| ``ConvertWXToPIL`(self, bmp)` Convert wx.Image into PIL image.
| ``DoGetBestSize`(self)` Overridden base class virtual.
| ``DrawFocusIndicator`(self, dc, width, height)` Draws the focus indicator.
| ``DrawLabel`(self, dc, width, height, dw, dh)` Draws the label on the button.
| ``DrawMainButton`(self, dc, width, height)` Draws the main button, in whichever state it is.
| ``Enable`(self, enable)` Enables/disables the button.
| ``GetAngleOfRotation`(self)` Returns angle of button label rotation (in degrees!!).
| ``GetButtonColour`(self)` Returns the button colour.
| ``GetEllipseAxis`(self)` Returns the ellipse axis.
| ``GetLabel`(self)` Returns the button label.
| ``GetLabelColour`(self)` Returns the button label colour.
| ``GetUseFocusIndicator`(self)` Returns focus indicator flag.
| ``InitColours`(self)` Calculates a new set of focus indicator colour and indicator pen based on button colour and label colour.
| ``IsEnabled`(self)` Returns wheter the button is enabled or not.
| ``IsOutside`(self, x, y)` Checks if a mouse events occurred inside the circle/ellipse or not.
| ``MakePalette`(self, tr, tg, tb)` Creates a palette to be applied on an image based on input colour.
| ``Notify`(self)` Notifies an event and let it be processed.
| ``OnGainFocus`(self, event)` Handles wx.EVT_SET_FOCUS events.
| ``OnKeyDown`(self, event)` Handles key down events just like wx.lib.buttons do.
| ``OnKeyUp`(self, event)` Handles key up events just like wx.lib.buttons do.
| ``OnLeftDown`(self, event)` Handles left down mouse events.
| ``OnLeftUp`(self, event)` Handles left up mouse events.
| ``OnLoseFocus`(self, event)` Handles wx.EVT_KILL_FOCUS events.
| ``OnMotion`(self, event)` Handles mouse motion events.
| ``OnPaint`(self, event)` Handles the wx.EVT_PAINT event.
| ``OnSize`(self, event)` Handles wx.EVT_SIZE events.
| ``SetAngleOfRotation`(self, angle)` Sets angle of button label rotation (in degrees!!).
| ``SetBestSize`(self, size)` Given the current font settings, calculate and set a good size.
| ``SetButtonColour`(self, colour)` Sets the button colour, for all button states.
| ``SetDefault`(self)` Sets the button as default item.
| ``SetEllipseAxis`(self, main, secondary)` Sets the ellipse axis.
| ``SetLabel`(self, label)` Sets the button label.
| ``SetLabelColour`(self, colour)` Sets the button label colour.
| ``SetUseFocusIndicator`(self, flag)` Specifies if a focus indicator (dotted line) should be used.
| ``ShouldInheritColours`(self)` Overridden base class virtual.

Property Summary

Instance Method Details

### __init__(self, parent, id=-1, label='', pos=wx.Point(-1, -1), size=wx.Size(-1, -1))
(Constructor)

Default class constructor.

Non standard wxPython parameters are:

1. label: the label you wish to assing to your SButton.

  Overrides:
    `wx.Window.__init__`

### AcceptsFocus(self)

Overridden base class virtual.

  Overrides:
    `wx.Window.AcceptsFocus`

### ConvertPILToWX(self, pil, alpha=True)

Convert PIL image into wx.Image.

### ConvertWXToPIL(self, bmp)

Convert wx.Image into PIL image.

### DoGetBestSize(self)

Overridden base class virtual. Determines the best size of the button based on the label size.

### DrawFocusIndicator(self, dc, width, height)

Draws the focus indicator. This is a circle/ellipse inside the button drawn with a dotted-style pen, to let the user know which button has the focus.

### DrawLabel(self, dc, width, height, dw=0, dh=0)

Draws the label on the button.

### DrawMainButton(self, dc, width, height)

Draws the main button, in whichever state it is.

### Enable(self, enable=True)

Enables/disables the button.

  Overrides:
    `wx.Window.Enable`

### GetAngleOfRotation(self)

Returns angle of button label rotation (in degrees!!).

### GetButtonColour(self)

Returns the button colour.

### GetEllipseAxis(self)

Returns the ellipse axis.

### GetLabel(self)

Returns the button label.

  Overrides:
    `wx.Window.GetLabel`

### GetLabelColour(self)

Returns the button label colour.

### GetUseFocusIndicator(self)

Returns focus indicator flag.

### InitColours(self)

Calculates a new set of focus indicator colour and indicator pen based on button colour and label colour.

### IsEnabled(self)

Returns wheter the button is enabled or not.

  Overrides:
    `wx.Window.IsEnabled`

### IsOutside(self, x, y)

Checks if a mouse events occurred inside the circle/ellipse or not.

### MakePalette(self, tr, tg, tb)

Creates a palette to be applied on an image based on input colour.

### Notify(self)

Notifies an event and let it be processed.

### OnGainFocus(self, event)

Handles wx.EVT_SET_FOCUS events.

### OnKeyDown(self, event)

Handles key down events just like wx.lib.buttons do.

### OnKeyUp(self, event)

Handles key up events just like wx.lib.buttons do.

### OnLeftDown(self, event)

Handles left down mouse events.

### OnLeftUp(self, event)

Handles left up mouse events.

### OnLoseFocus(self, event)

Handles wx.EVT_KILL_FOCUS events.

### OnMotion(self, event)

Handles mouse motion events.

### OnPaint(self, event)

Handles the wx.EVT_PAINT event. Mandatory on all platforms.

### OnSize(self, event)

Handles wx.EVT_SIZE events. Mandatory on windows (MSW).

### SetAngleOfRotation(self, angle=None)

Sets angle of button label rotation (in degrees!!).

### SetBestSize(self, size=None)

Given the current font settings, calculate and set a good size.

### SetButtonColour(self, colour=None)

Sets the button colour, for all button states.

The original button images are greyscale with a lot of pixels with different colours. Changing smoothly the button colour in order to give the same 3d effect can be efficiently done only with PIL.

### SetDefault(self)

Sets the button as default item.

### SetEllipseAxis(self, main=None, secondary=None)

Sets the ellipse axis. What it is important is not their absolute values but their ratio.

### SetLabel(self, label=None)

Sets the button label.

  Overrides:
    `wx.Window.SetLabel`

### SetLabelColour(self, colour=None)

Sets the button label colour.

### SetUseFocusIndicator(self, flag)

Specifies if a focus indicator (dotted line) should be used.

### ShouldInheritColours(self)

Overridden base class virtual. Buttons usually do not inherit parent's colours.

  Overrides:
    `wx.Window.ShouldInheritColours`

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:52:21 2009 | http://epydoc.sf.net