wx.lib.agw.aquabutton.AquaButton¶
This is the main class implementation of AquaButton.
Class Hierarchy¶
Control Appearance¶
Known Subclasses¶
wx.lib.agw.aquabutton.AquaToggleButton
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Can this window be given focus by mouse click? |
|
Overridden base class virtual. |
|
Overridden base class virtual. Determines the best size of the |
|
Enables/disables the button. |
|
Returns the button colour when the mouse is not hovering on the button. |
|
Overridden base class virtual. By default we should use |
|
Returns the button colour when it is disabled. |
|
Returns the button colour when the button has focus. |
|
Returns the text colour for |
|
Returns the button colour when the mouse is hovering on the button. |
|
Returns a rounded |
|
Returns whether the pulsing effect is active. |
|
Returns the button rectangular background colour. |
|
Returns the button shadow colour. |
|
Invalidate the saved bitmap and refresh the button. |
|
Return light contrast of colour. The colour returned is from the scale of |
|
Actually sends a |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Sets the |
|
Sets the bitmap label for the button. |
|
This sets the |
|
Sets the button colour when it is disabled. |
|
Sets the button colour when the button has focus. |
|
Sets the |
|
Sets the button colour when the mouse is hovering on the button. |
|
Given the current font and bezel width settings, calculate |
|
Sets whether to enable the pulsing effect on gaining focus or not. |
|
Sets the button rectangular background colour. |
|
Sets the button shadow colour. |
|
Overridden base class virtual. Buttons usually don’t inherit |
Class API¶
- class AquaButton(wx.Control)¶
This is the main class implementation of
AquaButton.
Methods¶
- __init__(self, parent, id=wx.ID_ANY, bitmap=None, label='', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator, name='aquabutton')¶
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(self)¶
Can this window be given focus by mouse click?
Note
Overridden from
wx.Control.
- DoEnable(self, enable)¶
Overridden base class virtual.
Need to Refresh otherwise Enable state change done from a
wx.EVT_UPDATE_UIwill not show.
- DoGetBestSize(self)¶
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.Control.
- Enable(self, enable=True)¶
Enables/disables the button.
- Parameters:
enable (bool) –
Trueto enable the button,Falseto disable it.
Note
Overridden from
wx.Control.
- GetBackgroundColour(self)¶
Returns the button colour when the mouse is not hovering on the button.
- Returns:
An instance of
wx.Colour.
Note
Overridden from
wx.Control.
- GetDefaultAttributes(self)¶
Overridden base class virtual. By default we should use the same font/colour attributes as the native
Button.- Returns:
an instance of
VisualAttributes.
Note
Overridden from
wx.Control.
- GetDisabledColour(self)¶
Returns the button colour when it is disabled.
- Returns:
An instance of
wx.Colour.
- GetFocusColour(self)¶
Returns the button colour when the button has focus.
- Returns:
An instance of
wx.Colour.
- GetForegroundColour(self)¶
Returns the text colour for
AquaButton.- Returns:
An instance of
wx.Colour.
Note
Overridden from
wx.Control.
- GetHoverColour(self)¶
Returns the button colour when the mouse is hovering on the button.
- Returns:
An instance of
wx.Colour.
- GetPath(self, gc, rc, r)¶
Returns a rounded
GraphicsPathrectangle.- Parameters:
gc – an instance of
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
GraphicsPath.
- GetPulseOnFocus(self)¶
Returns whether the pulsing effect is active.
- Returns:
Trueif the pulsing effect is active,Falseotherwise.
- GetRectColour(self)¶
Returns the button rectangular background colour.
- Returns:
An instance of
wx.Colour.
Added in version 0.9.7.
- GetShadowColour(self)¶
Returns the button shadow colour.
- Returns:
An instance of
wx.Colour.
Added in version 0.9.7.
- Invalidate(self)¶
Invalidate the saved bitmap and refresh the button.
- LightColour(self, colour, percent)¶
Return light contrast of colour. The colour returned is from the scale of colour ==> white.
- Notify(self)¶
Actually sends a
wx.EVT_BUTTONevent to the listener (if any).
- OnGainFocus(self, event)¶
Handles the
wx.EVT_SET_FOCUSevent forAquaButton.- Parameters:
event – a
FocusEventevent to be processed.
- OnKeyDown(self, event)¶
Handles the
wx.EVT_KEY_DOWNevent forAquaButton.- Parameters:
event – a
KeyEventevent to be processed.
- OnKeyUp(self, event)¶
Handles the
wx.EVT_KEY_UPevent forAquaButton.- Parameters:
event – a
KeyEventevent to be processed.
- OnLeftDown(self, event)¶
Handles the
wx.EVT_LEFT_DOWNevent forAquaButton.- Parameters:
event – a
MouseEventevent to be processed.
- OnLeftUp(self, event)¶
Handles the
wx.EVT_LEFT_UPevent forAquaButton.- Parameters:
event – a
MouseEventevent to be processed.
- OnLoseFocus(self, event)¶
Handles the
wx.EVT_KILL_FOCUSevent forAquaButton.- Parameters:
event – a
FocusEventevent to be processed.
- OnMouseEnter(self, event)¶
Handles the
wx.EVT_ENTER_WINDOWevent forAquaButton.- Parameters:
event – a
MouseEventevent to be processed.
- OnMouseLeave(self, event)¶
Handles the
wx.EVT_LEAVE_WINDOWevent forAquaButton.- Parameters:
event – a
MouseEventevent to be processed.
- OnPaint(self, event)¶
Handles the
wx.EVT_PAINTevent forAquaButton.- Parameters:
event – a
PaintEventevent to be processed.
- OnPulseTimer(self, event)¶
Handles the
wx.EVT_TIMERevent forAquaButton.- Parameters:
event – a
TimerEventevent to be processed.
Note
This method is only invoked when pulseOnFocus is
True.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZEevent forAquaButton.- Parameters:
event – a
wx.SizeEventevent to be processed.
- SetBackgroundColour(self, colour)¶
Sets the
AquaButtonbackground colour.- Parameters:
colour – a valid
wx.Colourobject.
Note
Overridden from
wx.Control.
- SetBitmapLabel(self, bitmap)¶
Sets the bitmap label for the button.
- Parameters:
bitmap – the bitmap label to set, an instance of
wx.Bitmap.
- SetDefault(self)¶
This sets the
AquaButtonto 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.SetFocuswhich sets the keyboard focus for windows and text panel items, andTopLevelWindow.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
SetDefaultafter you have created a row of buttons: wxPython will then set the size of all buttons currently on the panel to the same size.
- SetDisabledColour(self, colour)¶
Sets the button colour when it is disabled.
- Parameters:
colour – a valid
wx.Colourobject.
- SetFocusColour(self, colour)¶
Sets the button colour when the button has focus.
- Parameters:
colour – a valid
wx.Colourobject.
- SetForegroundColour(self, colour)¶
Sets the
AquaButtonforeground (text) colour.- Parameters:
colour – a valid
wx.Colourobject.
Note
Overridden from
wx.Control.
- SetHoverColour(self, colour)¶
Sets the button colour when the mouse is hovering on the button.
- Parameters:
colour – a valid
wx.Colourobject.
- SetInitialSize(self, size=None)¶
Given the current font and bezel width settings, calculate and set a good size.
- Parameters:
size – an instance of
wx.SizeorNone, in which case the wxWidgetsDefaultSizeis used instead.
- SetPulseOnFocus(self, pulse)¶
Sets whether to enable the pulsing effect on gaining focus or not.
- Parameters:
pulse (bool) –
Trueto enable pulsing when theAquaButtongains focus,Falseto disable this effect.
- SetRectColour(self, colour)¶
Sets the button rectangular background colour.
- Parameters:
colour – a valid
wx.Colourobject.
Added in version 0.9.7.
- SetShadowColour(self, colour)¶
Sets the button shadow colour.
- Parameters:
colour – a valid
wx.Colourobject.
Added in version 0.9.7.
- ShouldInheritColours(self)¶
Overridden base class virtual. Buttons usually don’t inherit the parent’s colours.
Note
Overridden from
wx.Control.