 
       wx.lib.agw.shapedbutton.SButton¶
  wx.lib.agw.shapedbutton.SButton¶This is the main implementation of ShapedButton.
 Methods Summary¶
 Methods Summary¶| __init__ | Default class constructor. | 
| AcceptsFocus | Can this window be given focus by mouse click? | 
| ConvertPILToWX | Converts a PIL image into a wx.Image. | 
| ConvertWXToPIL | Converts a wx.Imageinto a PIL image. | 
| DoGetBestSize | Overridden base class virtual. Determines the best size of the button | 
| DrawFocusIndicator | Draws the focus indicator. This is a circle/ellipse inside the button | 
| DrawLabel | Draws the label on the button. | 
| DrawMainButton | Draws the main button, in whichever state it is. | 
| Enable | Enables/disables the button. | 
| GetAngleOfRotation | Returns angle of button label rotation, in degrees. | 
| GetButtonColour | Returns the button colour. | 
| GetEllipseAxis | Returns the ellipse axes. | 
| GetLabel | Returns the button label. | 
| GetLabelColour | Returns the button label colour. | 
| GetUseFocusIndicator | Returns focus indicator flag. | 
| InitColours | Calculates a new set of focus indicator colour and indicator pen | 
| IsEnabled | Returns wheter the button is enabled or not. | 
| IsOutside | Checks if a mouse events occurred inside the circle/ellipse or not. | 
| MakePalette | Creates a palette to be applied on an image based on input colour. | 
| Notify | Notifies an event and let it be processed. | 
| OnGainFocus | Handles the wx.EVT_SET_FOCUSevent forSButton. | 
| OnKeyDown | Handles the wx.EVT_KEY_DOWNevent forSButton. | 
| OnKeyUp | Handles the wx.EVT_KEY_UPevent forSButton. | 
| OnLeftDown | Handles the wx.EVT_LEFT_DOWNevent forSButton. | 
| OnLeftUp | Handles the wx.EVT_LEFT_UPevent forSButton. | 
| OnLoseFocus | Handles the wx.EVT_KILL_FOCUSevent forSButton. | 
| OnMotion | Handles the wx.EVT_MOTIONevent forSButton. | 
| OnPaint | Handles the wx.EVT_PAINTevent forSButton. | 
| OnSize | Handles the wx.EVT_SIZEevent forSButton. | 
| SetAngleOfRotation | Sets angle of button label rotation. | 
| SetBestSize | Given the current font settings, calculate and set a good size. | 
| SetButtonColour | Sets the button colour, for all button states. | 
| SetDefault | Sets the button as default item. | 
| SetEllipseAxis | Sets the ellipse axis. What it is important is not their absolute values | 
| SetLabel | Sets the button label. | 
| SetLabelColour | Sets the button label colour. | 
| SetUseFocusIndicator | Specifies if a focus indicator (dotted line) should be used. | 
| ShouldInheritColours | Overridden base class virtual. Buttons usually do not inherit | 
 Class API¶
 Class API¶This is the main implementation of ShapedButton.
Default class constructor.
| Parameters: | 
 | 
|---|
Can this window be given focus by mouse click?
Note
Overridden from wx.Window.
Converts a PIL image into a wx.Image.
| Parameters: | 
 | 
|---|
Overridden base class virtual. Determines the best size of the button based on the label size.
Note
Overridden from wx.Window.
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.
| Parameters: | 
 | 
|---|
Draws the label on the button.
| Parameters: | 
 | 
|---|
Draws the main button, in whichever state it is.
| Parameters: | 
 | 
|---|
Enables/disables the button.
| Parameters: | enable – Trueto enable the button,Falseto disable it. | 
|---|
Note
Overridden from wx.Window.
Returns angle of button label rotation, in degrees.
Returns the button colour.
Returns the ellipse axes.
Returns the button label.
Returns the button label colour.
Returns focus indicator flag.
Calculates a new set of focus indicator colour and indicator pen based on button colour and label colour.
Returns wheter the button is enabled or not.
Checks if a mouse events occurred inside the circle/ellipse or not.
| Parameters: | 
 | 
|---|
Creates a palette to be applied on an image based on input colour.
| Parameters: | 
 | 
|---|
Notifies an event and let it be processed.
Handles the wx.EVT_SET_FOCUS event for SButton.
| Parameters: | event – a FocusEventevent to be processed. | 
|---|
Handles the wx.EVT_KEY_DOWN event for SButton.
| Parameters: | event – a KeyEventevent to be processed. | 
|---|
Handles the wx.EVT_KEY_UP event for SButton.
| Parameters: | event – a KeyEventevent to be processed. | 
|---|
Handles the wx.EVT_LEFT_DOWN event for SButton.
| Parameters: | event – a MouseEventevent to be processed. | 
|---|
Handles the wx.EVT_LEFT_UP event for SButton.
| Parameters: | event – a MouseEventevent to be processed. | 
|---|
Handles the wx.EVT_KILL_FOCUS event for SButton.
| Parameters: | event – a FocusEventevent to be processed. | 
|---|
Handles the wx.EVT_MOTION event for SButton.
| Parameters: | event – a MouseEventevent to be processed. | 
|---|
Handles the wx.EVT_PAINT event for SButton.
| Parameters: | event – a PaintEventevent to be processed. | 
|---|
Handles the wx.EVT_SIZE event for SButton.
| Parameters: | event – a wx.SizeEventevent to be processed. | 
|---|
Sets angle of button label rotation.
| Parameters: | angle – the label rotation, in degrees. | 
|---|
Given the current font settings, calculate and set a good size.
| Parameters: | size – if not None, an instance ofwx.Sizeto pass toSetInitialSize. | 
|---|
Sets the button colour, for all button states.
| Parameters: | colour – an instance of wx.Colour. | 
|---|
Note
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.
Sets the button as default item.
Sets the ellipse axis. What it is important is not their absolute values but their ratio.
| Parameters: | 
 | 
|---|
Sets the button label.
| Parameters: | label – the new button label. | 
|---|
Sets the button label colour.
| Parameters: | colour – an instance of wx.Colour. | 
|---|
Specifies if a focus indicator (dotted line) should be used.
| Parameters: | flag – Trueto use the focus indicator,Falseotherwise. | 
|---|
Overridden base class virtual. Buttons usually do not inherit parent’s colours.