AGW Logo

agw_title GradientButton

This is the main class implementation of GradientButton.

hierarchy Inheritance Diagram

Inheritance diagram for: GradientButton

Inheritance diagram of GradientButton


appearance Control Appearance


GradientButton

GradientButton


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.
GetBottomEndColourReturns the bottom end colour for the gradient shading.
GetBottomStartColourReturns the bottom start colour for the gradient shading.
GetDefaultAttributesOverridden base class virtual.
GetPathReturns a rounded wx.GraphicsPath rectangle.
GetPressedBottomColourReturns the pressed bottom start colour for the gradient shading.
GetPressedTopColourReturns the pressed top start colour for the gradient shading.
GetTopEndColourReturns the top end colour for the gradient shading.
GetTopStartColourReturns the top start colour for the gradient shading.
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 GradientButton.
OnKeyDownHandles the wx.EVT_KEY_DOWN event for GradientButton.
OnKeyUpHandles the wx.EVT_KEY_UP event for GradientButton.
OnLeftDownHandles the wx.EVT_LEFT_DOWN event for GradientButton.
OnLeftUpHandles the wx.EVT_LEFT_UP event for GradientButton.
OnLoseFocusHandles the wx.EVT_KILL_FOCUS event for GradientButton.
OnMouseEnterHandles the wx.EVT_ENTER_WINDOW event for GradientButton.
OnMouseLeaveHandles the wx.EVT_LEAVE_WINDOW event for GradientButton.
OnPaintHandles the wx.EVT_PAINT event for GradientButton.
OnSizeHandles the wx.EVT_SIZE event for GradientButton.
SetBaseColoursSets the bottom, top, pressed and foreground colour
SetBestSizeGiven the current font and bezel width settings, calculate and set a good size.
SetBottomEndColourSets the bottom end colour for the gradient shading.
SetBottomStartColourSets the top bottom colour for the gradient shading.
SetDefaultSets the default button.
SetForegroundColourSets the GradientButton foreground (text) colour.
SetInitialSizeGiven the current font and bezel width settings, calculate and set a good size.
SetPressedBottomColourSets the pressed bottom start colour for the gradient shading.
SetPressedTopColourSets the pressed top start colour for the gradient shading.
SetTopEndColourSets the top end colour for the gradient shading.
SetTopStartColourSets the top start colour for the gradient shading.
ShouldInheritColoursOverridden base class virtual.

API Class API

class GradientButton(wx.PyControl)[source]

This is the main class implementation of GradientButton.



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

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);
  • validator – the validator associated to the button;
  • name – 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.

Note

Overridden from wx.PyControl.



Enable(enable=True)[source]

Enables/disables the button.

Parameters:enableTrue to enable the button, False to disable it.

Note

Overridden from wx.PyControl.



GetBottomEndColour()[source]

Returns the bottom end colour for the gradient shading.



GetBottomStartColour()[source]

Returns the bottom start colour for the gradient shading.



GetDefaultAttributes()[source]

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



GetPath(gc, rc, r)[source]

Returns a rounded wx.GraphicsPath rectangle.

Parameters:
  • gc – an instance of wx.GraphicsContext;
  • rc – a client rectangle;
  • r – the radious of the rounded part of the rectangle.


GetPressedBottomColour()[source]

Returns the pressed bottom start colour for the gradient shading.



GetPressedTopColour()[source]

Returns the pressed top start colour for the gradient shading.



GetTopEndColour()[source]

Returns the top end colour for the gradient shading.



GetTopStartColour()[source]

Returns the top start colour for the gradient shading.



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;
  • percent – determines how light the colour will be. percent = 100 returns white, percent = 0 returns 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 GradientButton.

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


OnKeyDown(event)[source]

Handles the wx.EVT_KEY_DOWN event for GradientButton.

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


OnKeyUp(event)[source]

Handles the wx.EVT_KEY_UP event for GradientButton.

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



OnLeftDown(event)[source]

Handles the wx.EVT_LEFT_DOWN event for GradientButton.

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


OnLeftUp(event)[source]

Handles the wx.EVT_LEFT_UP event for GradientButton.

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



OnLoseFocus(event)[source]

Handles the wx.EVT_KILL_FOCUS event for GradientButton.

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



OnMouseEnter(event)[source]

Handles the wx.EVT_ENTER_WINDOW event for GradientButton.

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



OnMouseLeave(event)[source]

Handles the wx.EVT_LEAVE_WINDOW event for GradientButton.

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



OnPaint(event)[source]

Handles the wx.EVT_PAINT event for GradientButton.

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


OnSize(event)[source]

Handles the wx.EVT_SIZE event for GradientButton.

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


SetBaseColours(startcolour=wx.BLACK, foregroundcolour=wx.WHITE)[source]

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


SetBestSize(size=None)

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

Parameters:size – an instance of wx.Size.


SetBottomEndColour(colour)[source]

Sets the bottom end colour for the gradient shading.

Parameters:colour – a valid wx.Colour object.


SetBottomStartColour(colour)[source]

Sets the top bottom colour for the gradient shading.

Parameters:colour – a valid wx.Colour object.



SetDefault()[source]

Sets the default button.



SetForegroundColour(colour)[source]

Sets the GradientButton foreground (text) colour.

Parameters:colour – a valid wx.Colour object.

Note

Overridden from wx.PyControl.



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.



SetPressedBottomColour(colour)[source]

Sets the pressed bottom start colour for the gradient shading.

Parameters:colour – a valid wx.Colour object.



SetPressedTopColour(colour)[source]

Sets the pressed top start colour for the gradient shading.

Parameters:colour – a valid wx.Colour object.



SetTopEndColour(colour)[source]

Sets the top end colour for the gradient shading.

Parameters:colour – a valid wx.Colour object.



SetTopStartColour(colour)[source]

Sets the top start colour for the gradient shading.

Parameters:colour – a valid wx.Colour object.



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

gradientbutton

Next topic

GradientButtonEvent