.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.agw.gradientbutton

.. highlight:: python



.. _wx.lib.agw.gradientbutton.GradientButton:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.gradientbutton.GradientButton**
==========================================================================================================================================

This is the main class implementation of :class:`GradientButton`. 



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>GradientButton</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.agw.gradientbutton.GradientButton_inheritance.svg" alt="Inheritance diagram of GradientButton" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.gradientbutton.GradientButton.html" title="This is the main class implementation of GradientButton." alt="" coords="5,389,325,418"/> <area shape="rect" id="node2" href="wx.Control.html" title="This is the base class for a control or 'widget'." alt="" coords="113,313,218,341"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window  is the base class for all windows and represents any visible object on screen." alt="" coords="110,236,221,265"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="91,159,239,188"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="A class that can handle events from the windowing system." alt="" coords="99,82,232,111"/> <area shape="rect" id="node6" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="49,5,148,34"/> <area shape="rect" id="node7" href="wx.Trackable.html" title="Add-on base class for a trackable object." alt="" coords="172,5,295,34"/> </map> 
   </p>
   </div>

|


|appearance| Control Appearance
===============================

|

.. container:: control-appearance-figures

   .. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.gradientbutton.gradientbutton.png
      :alt: wxMSW
      :figclass: appearance-figure

      **wxMSW**


   .. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
      :alt: wxMAC
      :figclass: appearance-figure

      **wxMAC**


   .. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
      :alt: wxGTK
      :figclass: appearance-figure

      **wxGTK**

|




|super_classes| Known Superclasses
==================================

:class:`wx.Control`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.gradientbutton.GradientButton.__init__`                       Default class constructor.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.AcceptsFocus`                   Can this window be given focus by mouse click?
:meth:`~wx.lib.agw.gradientbutton.GradientButton.DoGetBestSize`                  Overridden base class virtual. Determines the best size of the
:meth:`~wx.lib.agw.gradientbutton.GradientButton.Enable`                         Enables/disables the button.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.GetBottomEndColour`             Returns the bottom end colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.GetBottomStartColour`           Returns the bottom start colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.GetDefaultAttributes`           Overridden base class virtual. By default we should use
:meth:`~wx.lib.agw.gradientbutton.GradientButton.GetPath`                        Returns a rounded :class:`GraphicsPath` rectangle.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.GetPressedBottomColour`         Returns the pressed bottom start colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.GetPressedTopColour`            Returns the pressed top start colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.GetTopEndColour`                Returns the top end colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.GetTopStartColour`              Returns the top start colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.LightColour`                    Return light contrast of `colour`. The colour returned is from the scale of
:meth:`~wx.lib.agw.gradientbutton.GradientButton.Notify`                         Actually sends a ``wx.EVT_BUTTON`` event to the listener (if any).
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnGainFocus`                    Handles the ``wx.EVT_SET_FOCUS`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnKeyDown`                      Handles the ``wx.EVT_KEY_DOWN`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnKeyUp`                        Handles the ``wx.EVT_KEY_UP`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnLeftDown`                     Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnLeftUp`                       Handles the ``wx.EVT_LEFT_UP`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnLoseFocus`                    Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnMouseEnter`                   Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnMouseLeave`                   Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnPaint`                        Handles the ``wx.EVT_PAINT`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.OnSize`                         Handles the ``wx.EVT_SIZE`` event for :class:`GradientButton`.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetBaseColours`                 Sets the bottom, top, pressed and foreground colour
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetBitmapLabel`                 Sets the bitmap label for the button.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetBottomEndColour`             Sets the bottom end colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetBottomStartColour`           Sets the top bottom colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetDefault`                     Sets the default button.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetForegroundColour`            Sets the :class:`GradientButton` foreground (text) colour.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetInitialSize`                 Given the current font and bezel width settings, calculate
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetPressedBottomColour`         Sets the pressed bottom start colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetPressedTopColour`            Sets the pressed top start colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetTopEndColour`                Sets the top end colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.SetTopStartColour`              Sets the top start colour for the gradient shading.
:meth:`~wx.lib.agw.gradientbutton.GradientButton.ShouldInheritColours`           Overridden base class virtual. Buttons usually don't inherit
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: GradientButton(wx.Control)

   This is the main class implementation of :class:`GradientButton`. 

   .. method:: __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.
      
      :param `parent`: the :class:`GradientButton` parent;
      :param `id`: window identifier. A value of -1 indicates a default value;
      :param `bitmap`: the button bitmap (if any);
      :param `label`: the button text label;
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :param `style`: the button style (unused);
      :param `align`: text/bitmap alignment. wx.CENTER or wx.LEFT;
      :param `validator`: the validator associated to the button;
      :param `name`: the button name.


   .. method:: AcceptsFocus(self)

      Can this window be given focus by mouse click?
      
      .. note:: Overridden from :class:`wx.Control`.


   .. method:: DoGetBestSize(self)

      Overridden base class virtual. Determines the best size of the
      button based on the label and bezel size.
      
      .. note:: Overridden from :class:`wx.Control`.


   .. method:: Enable(self, enable=True)

      Enables/disables the button.
      
      :param `enable`: ``True`` to enable the button, ``False`` to disable it.
      
      .. note:: Overridden from :class:`wx.Control`.


   .. method:: GetBottomEndColour(self)

      Returns the bottom end colour for the gradient shading. 


   .. method:: GetBottomStartColour(self)

      Returns the bottom start colour for the gradient shading. 


   .. method:: GetDefaultAttributes(self)

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


   .. method:: GetPath(self, gc, rc, r)

      Returns a rounded :class:`GraphicsPath` rectangle.
      
      :param `gc`: an instance of :class:`GraphicsContext`;
      :param `rc`: a client rectangle;
      :param `r`: the radious of the rounded part of the rectangle.


   .. method:: GetPressedBottomColour(self)

      Returns the pressed bottom start colour for the gradient shading. 


   .. method:: GetPressedTopColour(self)

      Returns the pressed top start colour for the gradient shading. 


   .. method:: GetTopEndColour(self)

      Returns the top end colour for the gradient shading. 


   .. method:: GetTopStartColour(self)

      Returns the top start colour for the gradient shading. 


   .. method:: LightColour(self, colour, percent)

      Return light contrast of `colour`. The colour returned is from the scale of
      `colour` ==> white.
      
      :param `colour`: the input colour to be brightened;
      :param `percent`: determines how light the colour will be. `percent` = 100
       returns white, `percent` = 0 returns `colour`.


   .. method:: Notify(self)

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


   .. method:: OnGainFocus(self, event)

      Handles the ``wx.EVT_SET_FOCUS`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`FocusEvent` event to be processed.


   .. method:: OnKeyDown(self, event)

      Handles the ``wx.EVT_KEY_DOWN`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`KeyEvent` event to be processed.


   .. method:: OnKeyUp(self, event)

      Handles the ``wx.EVT_KEY_UP`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`KeyEvent` event to be processed.


   .. method:: OnLeftDown(self, event)

      Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnLeftUp(self, event)

      Handles the ``wx.EVT_LEFT_UP`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnLoseFocus(self, event)

      Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`FocusEvent` event to be processed.


   .. method:: OnMouseEnter(self, event)

      Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnMouseLeave(self, event)

      Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`MouseEvent` event to be processed.


   .. method:: OnPaint(self, event)

      Handles the ``wx.EVT_PAINT`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`PaintEvent` event to be processed.


   .. method:: OnSize(self, event)

      Handles the ``wx.EVT_SIZE`` event for :class:`GradientButton`.
      
      :param `event`: a :class:`wx.SizeEvent` event to be processed.


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

      Sets the bottom, top, pressed and foreground colour
      
      :param startcolour: based colour to be used for bottom, top and pressed
      :param foregroundcolour: colour used for the text


   .. method:: SetBitmapLabel(self, bitmap)

      Sets the bitmap label for the button.
      
      :param `bitmap`: the bitmap label to set, an instance of :class:`wx.Bitmap`.


   .. method:: SetBottomEndColour(self, colour)

      Sets the bottom end colour for the gradient shading.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: SetBottomStartColour(self, colour)

      Sets the top bottom colour for the gradient shading.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: SetDefault(self)

      Sets the default button. 


   .. method:: SetForegroundColour(self, colour)

      Sets the :class:`GradientButton` foreground (text) colour.
      
      :param `colour`: a valid :class:`wx.Colour` object.
      
      .. note:: Overridden from :class:`wx.Control`.


   .. method:: SetInitialSize(self, size=None)

      Given the current font and bezel width settings, calculate
      and set a good size.
      
      :param `size`: an instance of :class:`wx.Size`.


   .. method:: SetPressedBottomColour(self, colour)

      Sets the pressed bottom start colour for the gradient shading.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: SetPressedTopColour(self, colour)

      Sets the pressed top start colour for the gradient shading.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: SetTopEndColour(self, colour)

      Sets the top end colour for the gradient shading.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: SetTopStartColour(self, colour)

      Sets the top start colour for the gradient shading.
      
      :param `colour`: a valid :class:`wx.Colour` object.


   .. method:: ShouldInheritColours(self)

      Overridden base class virtual. Buttons usually don't inherit
      the parent's colours.
      
      .. note:: Overridden from :class:`wx.Control`.