This is the main implementation of ShapedButton.
__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.Image into 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_FOCUS event for SButton . |
OnKeyDown |
Handles the wx.EVT_KEY_DOWN event for SButton . |
OnKeyUp |
Handles the wx.EVT_KEY_UP event for SButton . |
OnLeftDown |
Handles the wx.EVT_LEFT_DOWN event for SButton . |
OnLeftUp |
Handles the wx.EVT_LEFT_UP event for SButton . |
OnLoseFocus |
Handles the wx.EVT_KILL_FOCUS event for SButton . |
OnMotion |
Handles the wx.EVT_MOTION event for SButton . |
OnPaint |
Handles the wx.EVT_PAINT event for SButton . |
OnSize |
Handles the wx.EVT_SIZE event for SButton . |
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 |
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 – True to enable the button, False to 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 FocusEvent event to be processed. |
---|
Handles the wx.EVT_KEY_DOWN
event for SButton
.
Parameters: | event – a KeyEvent event to be processed. |
---|
Handles the wx.EVT_KEY_UP
event for SButton
.
Parameters: | event – a KeyEvent event to be processed. |
---|
Handles the wx.EVT_LEFT_DOWN
event for SButton
.
Parameters: | event – a MouseEvent event to be processed. |
---|
Handles the wx.EVT_LEFT_UP
event for SButton
.
Parameters: | event – a MouseEvent event to be processed. |
---|
Handles the wx.EVT_KILL_FOCUS
event for SButton
.
Parameters: | event – a FocusEvent event to be processed. |
---|
Handles the wx.EVT_MOTION
event for SButton
.
Parameters: | event – a MouseEvent event to be processed. |
---|
Handles the wx.EVT_PAINT
event for SButton
.
Parameters: | event – a PaintEvent event to be processed. |
---|
Handles the wx.EVT_SIZE
event for SButton
.
Parameters: | event – a wx.SizeEvent event 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 of wx.Size to pass to
SetInitialSize . |
---|
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 – True to use the focus indicator, False otherwise. |
---|
Overridden base class virtual. Buttons usually do not inherit parent’s colours.