AGW Logo

agw_title AquaButton

This is the main class implementation of AquaButton.

hierarchy Inheritance Diagram

Inheritance diagram for: AquaButton

Inheritance diagram of AquaButton


appearance Control Appearance


AquaButton

AquaButton


method_summary Methods Summary

__init__Default class constructor.
AcceptsFocusCan this window be given focus by mouse click? ..
DoGetBestSizeOverridden base class virtual.
EnableEnables/disables the button.
GetBackgroundColourReturns the button colour when the mouse is not hovering on the button.
GetDefaultAttributesOverridden base class virtual.
GetDisabledColorReturns the button colour when it is disabled.
GetDisabledColourReturns the button colour when it is disabled.
GetForegroundColourReturns the text colour for AquaButton.
GetHoverColorReturns the button colour when the mouse is hovering on the button.
GetHoverColourReturns the button colour when the mouse is hovering on the button.
GetPathReturns a rounded wx.GraphicsPath rectangle.
GetPulseOnFocusReturns whether the pulsing effect is active.
InvalidateInvalidate the saved bitmap and refresh the button.
LightColourReturn light contrast of colour.
NotifyActually sends a wx.EVT_BUTTON event to the listener (if any).
OnGainFocusHandles the wx.EVT_SET_FOCUS event for AquaButton.
OnKeyDownHandles the wx.EVT_KEY_DOWN event for AquaButton.
OnKeyUpHandles the wx.EVT_KEY_UP event for AquaButton.
OnLeftDownHandles the wx.EVT_LEFT_DOWN event for AquaButton.
OnLeftUpHandles the wx.EVT_LEFT_UP event for AquaButton.
OnLoseFocusHandles the wx.EVT_KILL_FOCUS event for AquaButton.
OnMouseEnterHandles the wx.EVT_ENTER_WINDOW event for AquaButton.
OnMouseLeaveHandles the wx.EVT_LEAVE_WINDOW event for AquaButton.
OnPaintHandles the wx.EVT_PAINT event for AquaButton.
OnPulseTimerHandles the wx.EVT_TIMER event for AquaButton.
OnSizeHandles the wx.EVT_SIZE event for AquaButton.
SetBackgroundColorSets the AquaButton background colour.
SetBackgroundColourSets the AquaButton background colour.
SetBestSizeGiven the current font and bezel width settings, calculate and set a good size.
SetBitmapLabelSets the bitmap label for the button.
SetDefaultThis sets the AquaButton to be the default item for the panel or dialog box.
SetDisabledColorSets the button colour when it is disabled.
SetDisabledColourSets the button colour when it is disabled.
SetForegroundColourSets the AquaButton foreground (text) colour.
SetHoverColorSets the button colour when the mouse is hovering on the button.
SetHoverColourSets the button colour when the mouse is hovering on the button.
SetInitialSizeGiven the current font and bezel width settings, calculate and set a good size.
SetPulseOnFocusSets whether to enable the pulsing effect on gaining focus or not.
ShouldInheritColoursOverridden base class virtual.

API Class API

class AquaButton(wx.PyControl)[source]

This is the main class implementation of AquaButton.



__init__(parent, id=wx.ID_ANY, bitmap=None, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator, name="aquabutton")[source]

Default class constructor.

Parameters:
  • parent (wx.Window) – parent window. Must not be None;
  • id (integer) – window identifier. A value of -1 indicates a default value;
  • bitmap (wx.Bitmap) – the button bitmap (if any);
  • label (string) – the button text label;
  • pos (tuple or wx.Point) – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
  • size (tuple or wx.Size) – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
  • style (integer) – the button style (unused);
  • validator (wx.Validator) – the validator associated to the button;
  • name (string) – the button name.


AcceptsFocus()[source]

Can this window be given focus by mouse click?

Note

Overridden from wx.PyControl.



DoGetBestSize()[source]

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

Returns:An instance of wx.Size.

Note

Overridden from wx.PyControl.



Enable(enable=True)[source]

Enables/disables the button.

Parameters:enable (bool) – True to enable the button, False to disable it.

Note

Overridden from wx.PyControl.



GetBackgroundColour()[source]

Returns the button colour when the mouse is not hovering on the button.

Returns:An instance of wx.Colour.

Note

Overridden from wx.PyControl.



GetDefaultAttributes()[source]

Overridden base class virtual. By default we should use the same font/colour attributes as the native wx.Button.

Returns:an instance of wx.VisualAttributes.

Note

Overridden from wx.PyControl.



GetDisabledColor()

Returns the button colour when it is disabled.

Returns:An instance of wx.Colour.


GetDisabledColour()[source]

Returns the button colour when it is disabled.

Returns:An instance of wx.Colour.


GetForegroundColour()[source]

Returns the text colour for AquaButton.

Returns:An instance of wx.Colour.

Note

Overridden from wx.PyControl.



GetHoverColor()

Returns the button colour when the mouse is hovering on the button.

Returns:An instance of wx.Colour.


GetHoverColour()[source]

Returns the button colour when the mouse is hovering on the button.

Returns:An instance of wx.Colour.


GetPath(gc, rc, r)[source]

Returns a rounded wx.GraphicsPath rectangle.

Parameters:
  • gc – an instance of wx.GraphicsContext;
  • rc (wx.Rect) – a client rectangle;
  • r (float) – the radius of the rounded part of the rectangle.
Returns:

A rounded rectangle, an instance of wx.GraphicsPath.



GetPulseOnFocus()[source]

Returns whether the pulsing effect is active.

Returns:True if the pulsing effect is active, False otherwise.


Invalidate()[source]

Invalidate the saved bitmap and refresh the button.



LightColour(colour, percent)[source]

Return light contrast of colour. The colour returned is from the scale of colour ==> white.

Parameters:
  • colour – the input colour to be brightened, a valid instance of wx.Colour;

  • percent (integer) – determines how light the colour will be. percent = 100 returns white, percent = 0 returns colour.
Returns:

A light contrast of the input colour, an instance of wx.Colour.



Notify()[source]

Actually sends a wx.EVT_BUTTON event to the listener (if any).



OnGainFocus(event)[source]

Handles the wx.EVT_SET_FOCUS event for AquaButton.

Parameters:event – a wx.FocusEvent event to be processed.


OnKeyDown(event)[source]

Handles the wx.EVT_KEY_DOWN event for AquaButton.

Parameters:event – a wx.KeyEvent event to be processed.


OnKeyUp(event)[source]

Handles the wx.EVT_KEY_UP event for AquaButton.

Parameters:event – a wx.KeyEvent event to be processed.



OnLeftDown(event)[source]

Handles the wx.EVT_LEFT_DOWN event for AquaButton.

Parameters:event – a wx.MouseEvent event to be processed.


OnLeftUp(event)[source]

Handles the wx.EVT_LEFT_UP event for AquaButton.

Parameters:event – a wx.MouseEvent event to be processed.



OnLoseFocus(event)[source]

Handles the wx.EVT_KILL_FOCUS event for AquaButton.

Parameters:event – a wx.FocusEvent event to be processed.



OnMouseEnter(event)[source]

Handles the wx.EVT_ENTER_WINDOW event for AquaButton.

Parameters:event – a wx.MouseEvent event to be processed.



OnMouseLeave(event)[source]

Handles the wx.EVT_LEAVE_WINDOW event for AquaButton.

Parameters:event – a wx.MouseEvent event to be processed.



OnPaint(event)[source]

Handles the wx.EVT_PAINT event for AquaButton.

Parameters:event – a wx.PaintEvent event to be processed.


OnPulseTimer(event)[source]

Handles the wx.EVT_TIMER event for AquaButton.

Parameters:event – a wx.TimerEvent event to be processed.

Note

This method is only invoked when pulseOnFocus is True.



OnSize(event)[source]

Handles the wx.EVT_SIZE event for AquaButton.

Parameters:event – a wx.SizeEvent event to be processed.


SetBackgroundColor(colour)

Sets the AquaButton background colour.

Parameters:colour – a valid wx.Colour object.

Note

Overridden from wx.PyControl.



SetBackgroundColour(colour)[source]

Sets the AquaButton background colour.

Parameters:colour – a valid wx.Colour object.

Note

Overridden from wx.PyControl.



SetBestSize(size=None)

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

Parameters:size – an instance of wx.Size or None, in which case the wxWidgets wx.DefaultSize is used instead.



SetBitmapLabel(bitmap)[source]

Sets the bitmap label for the button.

Parameters:bitmap – the bitmap label to set, an instance of wx.Bitmap.


SetDefault()[source]

This sets the AquaButton to be the default item for the panel or dialog box.

Note

Under Windows, only dialog box buttons respond to this function. As normal under Windows and Motif, pressing return causes the default button to be depressed when the return key is pressed. See also wx.Window.SetFocus which sets the keyboard focus for windows and text panel items, and wx.TopLevelWindow.SetDefaultItem.

Note

Note that under Motif, calling this function immediately after creation of a button and before the creation of other buttons will cause misalignment of the row of buttons, since default buttons are larger. To get around this, call SetDefault after you have created a row of buttons: wxPython will then set the size of all buttons currently on the panel to the same size.



SetDisabledColor(colour)

Sets the button colour when it is disabled.

Parameters:colour – a valid wx.Colour object.



SetDisabledColour(colour)[source]

Sets the button colour when it is disabled.

Parameters:colour – a valid wx.Colour object.



SetForegroundColour(colour)[source]

Sets the AquaButton foreground (text) colour.

Parameters:colour – a valid wx.Colour object.

Note

Overridden from wx.PyControl.



SetHoverColor(colour)

Sets the button colour when the mouse is hovering on the button.

Parameters:colour – a valid wx.Colour object.



SetHoverColour(colour)[source]

Sets the button colour when the mouse is hovering on the button.

Parameters:colour – a valid wx.Colour object.



SetInitialSize(size=None)[source]

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

Parameters:size – an instance of wx.Size or None, in which case the wxWidgets wx.DefaultSize is used instead.



SetPulseOnFocus(pulse)[source]

Sets whether to enable the pulsing effect on gaining focus or not.

Parameters:pulse (bool) – True to enable pulsing when the AquaButton gains focus, False to disable this effect.


ShouldInheritColours()[source]

Overridden base class virtual. Buttons usually don’t inherit the parent’s colours.

Note

Overridden from wx.PyControl.

Tree

Table Of Contents

Previous topic

aquabutton

Next topic

AquaButtonEvent