Table Of Contents

Previous topic

gradientbutton

Next topic

GradientButtonEvent

This Page

phoenix_title GradientButton

This is the main class implementation of GradientButton.


class_hierarchy Inheritance Diagram

Inheritance diagram for class GradientButton

Inheritance diagram of GradientButton


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


super_classes Known Superclasses

PyControl


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 EVT_BUTTON event to the listener (if any).
OnGainFocus Handles the EVT_SET_FOCUS event for GradientButton.
OnKeyDown Handles the EVT_KEY_DOWN event for GradientButton.
OnKeyUp Handles the EVT_KEY_UP event for GradientButton.
OnLeftDown Handles the EVT_LEFT_DOWN event for GradientButton.
OnLeftUp Handles the EVT_LEFT_UP event for GradientButton.
OnLoseFocus Handles the EVT_KILL_FOCUS event for GradientButton.
OnMouseEnter Handles the EVT_ENTER_WINDOW event for GradientButton.
OnMouseLeave Handles the EVT_LEAVE_WINDOW event for GradientButton.
OnPaint Handles the EVT_PAINT event for GradientButton.
OnSize Handles the EVT_SIZE event for GradientButton.
SetBaseColours Sets the bottom, top, pressed and foreground colour
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(PyControl)

This is the main class implementation of GradientButton.


Methods



__init__(self, parent, id=ID_ANY, bitmap=None, label="", pos=DefaultPosition, size=DefaultSize, style=NO_BORDER, validator=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);
  • 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 PyControl.



DoGetBestSize(self)

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

Note

Overridden from PyControl.



Enable(self, enable=True)

Enables/disables the button.

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

Note

Overridden from PyControl.



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 EVT_BUTTON event to the listener (if any).



OnGainFocus(self, event)

Handles the EVT_SET_FOCUS event for GradientButton.

Parameters:event – a FocusEvent event to be processed.


OnKeyDown(self, event)

Handles the EVT_KEY_DOWN event for GradientButton.

Parameters:event – a KeyEvent event to be processed.


OnKeyUp(self, event)

Handles the EVT_KEY_UP event for GradientButton.

Parameters:event – a KeyEvent event to be processed.


OnLeftDown(self, event)

Handles the EVT_LEFT_DOWN event for GradientButton.

Parameters:event – a MouseEvent event to be processed.


OnLeftUp(self, event)

Handles the EVT_LEFT_UP event for GradientButton.

Parameters:event – a MouseEvent event to be processed.


OnLoseFocus(self, event)

Handles the EVT_KILL_FOCUS event for GradientButton.

Parameters:event – a FocusEvent event to be processed.


OnMouseEnter(self, event)

Handles the EVT_ENTER_WINDOW event for GradientButton.

Parameters:event – a MouseEvent event to be processed.


OnMouseLeave(self, event)

Handles the EVT_LEAVE_WINDOW event for GradientButton.

Parameters:event – a MouseEvent event to be processed.


OnPaint(self, event)

Handles the EVT_PAINT event for GradientButton.

Parameters:event – a PaintEvent event to be processed.


OnSize(self, event)

Handles the EVT_SIZE event for GradientButton.

Parameters:event – a SizeEvent event to be processed.


SetBaseColours(self, startcolour=BLACK, foregroundcolour=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


SetBottomEndColour(self, colour)

Sets the bottom end colour for the gradient shading.

Parameters:colour – a valid Colour object.


SetBottomStartColour(self, colour)

Sets the top bottom colour for the gradient shading.

Parameters:colour – a valid Colour object.


SetDefault(self)

Sets the default button.



SetForegroundColour(self, colour)

Sets the GradientButton foreground (text) colour.

Parameters:colour – a valid Colour object.

Note

Overridden from PyControl.



SetInitialSize(self, size=None)

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

Parameters:size – an instance of Size.


SetPressedBottomColour(self, colour)

Sets the pressed bottom start colour for the gradient shading.

Parameters:colour – a valid Colour object.


SetPressedTopColour(self, colour)

Sets the pressed top start colour for the gradient shading.

Parameters:colour – a valid Colour object.


SetTopEndColour(self, colour)

Sets the top end colour for the gradient shading.

Parameters:colour – a valid Colour object.


SetTopStartColour(self, colour)

Sets the top start colour for the gradient shading.

Parameters:colour – a valid Colour object.


ShouldInheritColours(self)

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

Note

Overridden from PyControl.