phoenix_title wx.lib.agw.gradientbutton.GradientButton

This is the main class implementation of GradientButton.


class_hierarchy Class Hierarchy

Inheritance diagram for class GradientButton:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


super_classes Known Superclasses

wx.Control


method_summary Methods Summary

__init__

Default class constructor.

AcceptsFocus

Can this window be given focus by mouse click?

DoGetBestSize

Overridden base class virtual. Determines the best size of the

Enable

Enables/disables the button.

GetBottomEndColour

Returns the bottom end colour for the gradient shading.

GetBottomStartColour

Returns the bottom start colour for the gradient shading.

GetDefaultAttributes

Overridden base class virtual. By default we should use

GetPath

Returns a rounded GraphicsPath rectangle.

GetPressedBottomColour

Returns the pressed bottom start colour for the gradient shading.

GetPressedTopColour

Returns the pressed top start colour for the gradient shading.

GetTopEndColour

Returns the top end colour for the gradient shading.

GetTopStartColour

Returns the top start colour for the gradient shading.

LightColour

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

Notify

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

OnGainFocus

Handles the wx.EVT_SET_FOCUS event for GradientButton.

OnKeyDown

Handles the wx.EVT_KEY_DOWN event for GradientButton.

OnKeyUp

Handles the wx.EVT_KEY_UP event for GradientButton.

OnLeftDown

Handles the wx.EVT_LEFT_DOWN event for GradientButton.

OnLeftUp

Handles the wx.EVT_LEFT_UP event for GradientButton.

OnLoseFocus

Handles the wx.EVT_KILL_FOCUS event for GradientButton.

OnMouseEnter

Handles the wx.EVT_ENTER_WINDOW event for GradientButton.

OnMouseLeave

Handles the wx.EVT_LEAVE_WINDOW event for GradientButton.

OnPaint

Handles the wx.EVT_PAINT event for GradientButton.

OnSize

Handles the wx.EVT_SIZE event for GradientButton.

SetBaseColours

Sets the bottom, top, pressed and foreground colour

SetBitmapLabel

Sets the bitmap label for the button.

SetBottomEndColour

Sets the bottom end colour for the gradient shading.

SetBottomStartColour

Sets the top bottom colour for the gradient shading.

SetDefault

Sets the default button.

SetForegroundColour

Sets the GradientButton foreground (text) colour.

SetInitialSize

Given the current font and bezel width settings, calculate

SetPressedBottomColour

Sets the pressed bottom start colour for the gradient shading.

SetPressedTopColour

Sets the pressed top start colour for the gradient shading.

SetTopEndColour

Sets the top end colour for the gradient shading.

SetTopStartColour

Sets the top start colour for the gradient shading.

ShouldInheritColours

Overridden base class virtual. Buttons usually don’t inherit


api Class API

class GradientButton(wx.Control)

This is the main class implementation of GradientButton.


Methods

__init__(self, parent, id=wx.ID_ANY, bitmap=None, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, align=wx.CENTER, validator=wx.DefaultValidator, name="gradientbutton")

Default class constructor.

Parameters:
  • parent – the GradientButton parent;

  • id – window identifier. A value of -1 indicates a default value;

  • bitmap – the button bitmap (if any);

  • label – the button text label;

  • pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;

  • 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 – the button style (unused);

  • align – text/bitmap alignment. wx.CENTER or wx.LEFT;

  • validator – the validator associated to the button;

  • name – the button name.



AcceptsFocus(self)

Can this window be given focus by mouse click?

Note

Overridden from wx.Control.



DoGetBestSize(self)

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

Note

Overridden from wx.Control.



Enable(self, enable=True)

Enables/disables the button.

Parameters:

enableTrue to enable the button, False to disable it.

Note

Overridden from wx.Control.



GetBottomEndColour(self)

Returns the bottom end colour for the gradient shading.



GetBottomStartColour(self)

Returns the bottom start colour for the gradient shading.



GetDefaultAttributes(self)

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



GetPath(self, gc, rc, r)

Returns a rounded GraphicsPath rectangle.

Parameters:
  • gc – an instance of GraphicsContext;

  • rc – a client rectangle;

  • r – the radious of the rounded part of the rectangle.



GetPressedBottomColour(self)

Returns the pressed bottom start colour for the gradient shading.



GetPressedTopColour(self)

Returns the pressed top start colour for the gradient shading.



GetTopEndColour(self)

Returns the top end colour for the gradient shading.



GetTopStartColour(self)

Returns the top start colour for the gradient shading.



LightColour(self, colour, percent)

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

Parameters:
  • colour – the input colour to be brightened;

  • percent – determines how light the colour will be. percent = 100 returns white, percent = 0 returns colour.



Notify(self)

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



OnGainFocus(self, event)

Handles the wx.EVT_SET_FOCUS event for GradientButton.

Parameters:

event – a FocusEvent event to be processed.



OnKeyDown(self, event)

Handles the wx.EVT_KEY_DOWN event for GradientButton.

Parameters:

event – a KeyEvent event to be processed.



OnKeyUp(self, event)

Handles the wx.EVT_KEY_UP event for GradientButton.

Parameters:

event – a KeyEvent event to be processed.



OnLeftDown(self, event)

Handles the wx.EVT_LEFT_DOWN event for GradientButton.

Parameters:

event – a MouseEvent event to be processed.



OnLeftUp(self, event)

Handles the wx.EVT_LEFT_UP event for GradientButton.

Parameters:

event – a MouseEvent event to be processed.



OnLoseFocus(self, event)

Handles the wx.EVT_KILL_FOCUS event for GradientButton.

Parameters:

event – a FocusEvent event to be processed.



OnMouseEnter(self, event)

Handles the wx.EVT_ENTER_WINDOW event for GradientButton.

Parameters:

event – a MouseEvent event to be processed.



OnMouseLeave(self, event)

Handles the wx.EVT_LEAVE_WINDOW event for GradientButton.

Parameters:

event – a MouseEvent event to be processed.



OnPaint(self, event)

Handles the wx.EVT_PAINT event for GradientButton.

Parameters:

event – a PaintEvent event to be processed.



OnSize(self, event)

Handles the wx.EVT_SIZE event for GradientButton.

Parameters:

event – a wx.SizeEvent event to be processed.



SetBaseColours(self, startcolour=wx.BLACK, foregroundcolour=wx.WHITE)

Sets the bottom, top, pressed and foreground colour

Parameters:
  • startcolour – based colour to be used for bottom, top and pressed

  • foregroundcolour – colour used for the text



SetBitmapLabel(self, bitmap)

Sets the bitmap label for the button.

Parameters:

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



SetBottomEndColour(self, colour)

Sets the bottom end colour for the gradient shading.

Parameters:

colour – a valid wx.Colour object.



SetBottomStartColour(self, colour)

Sets the top bottom colour for the gradient shading.

Parameters:

colour – a valid wx.Colour object.



SetDefault(self)

Sets the default button.



SetForegroundColour(self, colour)

Sets the GradientButton foreground (text) colour.

Parameters:

colour – a valid wx.Colour object.

Note

Overridden from wx.Control.



SetInitialSize(self, size=None)

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

Parameters:

size – an instance of wx.Size.



SetPressedBottomColour(self, colour)

Sets the pressed bottom start colour for the gradient shading.

Parameters:

colour – a valid wx.Colour object.



SetPressedTopColour(self, colour)

Sets the pressed top start colour for the gradient shading.

Parameters:

colour – a valid wx.Colour object.



SetTopEndColour(self, colour)

Sets the top end colour for the gradient shading.

Parameters:

colour – a valid wx.Colour object.



SetTopStartColour(self, colour)

Sets the top start colour for the gradient shading.

Parameters:

colour – a valid wx.Colour object.



ShouldInheritColours(self)

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

Note

Overridden from wx.Control.