.. include:: headings.inc .. _AnyButton: ========================================================================================================================================== |phoenix_title| **AnyButton** ========================================================================================================================================== A class for common button functionality used as the base for the various button classes. | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **AnyButton** .. raw:: html

Inheritance diagram of AnyButton

| |sub_classes| Known Subclasses ============================== :ref:`Button`, :ref:`ToggleButton` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~AnyButton.__init__` :meth:`~AnyButton.GetBitmap` Return the bitmap shown by the button. :meth:`~AnyButton.GetBitmapCurrent` Returns the bitmap used when the mouse is over the button, which may be invalid. :meth:`~AnyButton.GetBitmapDisabled` Returns the bitmap for the disabled state, which may be invalid. :meth:`~AnyButton.GetBitmapFocus` Returns the bitmap for the focused state, which may be invalid. :meth:`~AnyButton.GetBitmapLabel` Returns the bitmap for the normal state. :meth:`~AnyButton.GetBitmapMargins` Get the margins between the bitmap and the text of the button. :meth:`~AnyButton.GetBitmapPressed` Returns the bitmap for the pressed state, which may be invalid. :meth:`~AnyButton.SetBitmap` Sets the bitmap to display in the button. :meth:`~AnyButton.SetBitmapCurrent` Sets the bitmap to be shown when the mouse is over the button. :meth:`~AnyButton.SetBitmapDisabled` Sets the bitmap for the disabled button appearance. :meth:`~AnyButton.SetBitmapFocus` Sets the bitmap for the button appearance when it has the keyboard focus. :meth:`~AnyButton.SetBitmapLabel` Sets the bitmap label for the button. :meth:`~AnyButton.SetBitmapMargins` Set the margins between the bitmap and the text of the button. :meth:`~AnyButton.SetBitmapPosition` Set the position at which the bitmap is displayed. :meth:`~AnyButton.SetBitmapPressed` Sets the bitmap for the selected (depressed) button appearance. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~AnyButton.Bitmap` See :meth:`~AnyButton.GetBitmap` and :meth:`~AnyButton.SetBitmap` :attr:`~AnyButton.BitmapCurrent` See :meth:`~AnyButton.GetBitmapCurrent` and :meth:`~AnyButton.SetBitmapCurrent` :attr:`~AnyButton.BitmapDisabled` See :meth:`~AnyButton.GetBitmapDisabled` and :meth:`~AnyButton.SetBitmapDisabled` :attr:`~AnyButton.BitmapFocus` See :meth:`~AnyButton.GetBitmapFocus` and :meth:`~AnyButton.SetBitmapFocus` :attr:`~AnyButton.BitmapLabel` See :meth:`~AnyButton.GetBitmapLabel` and :meth:`~AnyButton.SetBitmapLabel` :attr:`~AnyButton.BitmapMargins` See :meth:`~AnyButton.GetBitmapMargins` and :meth:`~AnyButton.SetBitmapMargins` :attr:`~AnyButton.BitmapPressed` See :meth:`~AnyButton.GetBitmapPressed` and :meth:`~AnyButton.SetBitmapPressed` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: AnyButton(Control) A class for common button functionality used as the base for the various button classes. **Possible constructors**:: AnyButton() .. method:: __init__(self) .. method:: GetBitmap(self) Return the bitmap shown by the button. The returned bitmap may be invalid only if the button doesn't show any images. :rtype: :ref:`Bitmap` .. versionadded:: 2.9.1 .. seealso:: :meth:`SetBitmap` .. method:: GetBitmapCurrent(self) Returns the bitmap used when the mouse is over the button, which may be invalid. :rtype: :ref:`Bitmap` .. versionadded:: 2.9.1 (available as `BitmapButton.GetBitmapHover()` in previous versions) .. seealso:: :meth:`SetBitmapCurrent` .. method:: GetBitmapDisabled(self) Returns the bitmap for the disabled state, which may be invalid. :rtype: :ref:`Bitmap` .. versionadded:: 2.9.1 (available in :ref:`BitmapButton` only in previous versions) .. seealso:: :meth:`SetBitmapDisabled` .. method:: GetBitmapFocus(self) Returns the bitmap for the focused state, which may be invalid. :rtype: :ref:`Bitmap` .. versionadded:: 2.9.1 (available in :ref:`BitmapButton` only in previous versions) .. seealso:: :meth:`SetBitmapFocus` .. method:: GetBitmapLabel(self) Returns the bitmap for the normal state. This is exactly the same as :meth:`GetBitmap` but uses a name backwards-compatible with :ref:`BitmapButton`. :rtype: :ref:`Bitmap` .. versionadded:: 2.9.1 (available in :ref:`BitmapButton` only in previous versions) .. seealso:: :meth:`SetBitmap` , :meth:`SetBitmapLabel` .. method:: GetBitmapMargins(self) Get the margins between the bitmap and the text of the button. :rtype: :ref:`Size` .. versionadded:: 2.9.1 .. seealso:: :meth:`SetBitmapMargins` .. method:: GetBitmapPressed(self) Returns the bitmap for the pressed state, which may be invalid. :rtype: :ref:`Bitmap` .. versionadded:: 2.9.1 (available as `BitmapButton.GetBitmapSelected()` in previous versions) .. seealso:: :meth:`SetBitmapPressed` .. method:: SetBitmap(self, bitmap, dir=LEFT) Sets the bitmap to display in the button. The bitmap is displayed together with the button label. This method sets up a single bitmap which is used in all button states, use :meth:`SetBitmapDisabled` , :meth:`SetBitmapPressed` , :meth:`SetBitmapCurrent` or :meth:`SetBitmapFocus` to change the individual images used in different states. :param `bitmap`: The bitmap to display in the button. May be invalid to remove any currently displayed bitmap. :type `bitmap`: Bitmap :param `dir`: The position of the bitmap inside the button. By default it is positioned to the left of the text, near to the left button border. Other possible values include ``RIGHT``, ``TOP`` and ``BOTTOM``. :type `dir`: Direction .. versionadded:: 2.9.1 .. seealso:: :meth:`SetBitmapPosition` , :meth:`SetBitmapMargins` .. method:: SetBitmapCurrent(self, bitmap) Sets the bitmap to be shown when the mouse is over the button. :param `bitmap`: :type `bitmap`: Bitmap .. versionadded:: 2.9.1 (available as `BitmapButton.SetBitmapHover()` in previous versions) .. seealso:: :meth:`GetBitmapCurrent` .. method:: SetBitmapDisabled(self, bitmap) Sets the bitmap for the disabled button appearance. :param `bitmap`: :type `bitmap`: Bitmap .. versionadded:: 2.9.1 (available in :ref:`BitmapButton` only in previous versions) .. seealso:: :meth:`GetBitmapDisabled` , :meth:`SetBitmapLabel` , :meth:`SetBitmapPressed` , :meth:`SetBitmapFocus` .. method:: SetBitmapFocus(self, bitmap) Sets the bitmap for the button appearance when it has the keyboard focus. :param `bitmap`: :type `bitmap`: Bitmap .. versionadded:: 2.9.1 (available in :ref:`BitmapButton` only in previous versions) .. seealso:: :meth:`GetBitmapFocus` , :meth:`SetBitmapLabel` , :meth:`SetBitmapPressed` , :meth:`SetBitmapDisabled` .. method:: SetBitmapLabel(self, bitmap) Sets the bitmap label for the button. :param `bitmap`: :type `bitmap`: Bitmap .. versionadded:: 2.9.1 (available in :ref:`BitmapButton` only in previous versions) .. note:: This is the bitmap used for the unselected state, and for all other states if no other bitmaps are provided. .. seealso:: :meth:`SetBitmap` , :meth:`GetBitmapLabel` .. method:: SetBitmapMargins(self, *args, **kw) Set the margins between the bitmap and the text of the button. This method is currently only implemented under MSW. If it is not called, default margin is used around the bitmap. .. versionadded:: 2.9.1 .. seealso:: :meth:`SetBitmap` , :meth:`SetBitmapPosition` |overload| **Overloaded Implementations**: **~~~** **SetBitmapMargins** `(self, x, y)` :param `x`: :type `x`: int :param `y`: :type `y`: int **~~~** **SetBitmapMargins** `(self, sz)` :param `sz`: :type `sz`: Size **~~~** .. method:: SetBitmapPosition(self, dir) Set the position at which the bitmap is displayed. This method should only be called if the button does have an associated bitmap. :param `dir`: Direction in which the bitmap should be positioned, one of ``LEFT``, ``RIGHT``, ``TOP`` or ``BOTTOM``. :type `dir`: Direction .. versionadded:: 2.9.1 .. method:: SetBitmapPressed(self, bitmap) Sets the bitmap for the selected (depressed) button appearance. :param `bitmap`: :type `bitmap`: Bitmap .. versionadded:: 2.9.1 (available as `BitmapButton.SetBitmapSelected()` in previous versions) .. attribute:: Bitmap See :meth:`~AnyButton.GetBitmap` and :meth:`~AnyButton.SetBitmap` .. attribute:: BitmapCurrent See :meth:`~AnyButton.GetBitmapCurrent` and :meth:`~AnyButton.SetBitmapCurrent` .. attribute:: BitmapDisabled See :meth:`~AnyButton.GetBitmapDisabled` and :meth:`~AnyButton.SetBitmapDisabled` .. attribute:: BitmapFocus See :meth:`~AnyButton.GetBitmapFocus` and :meth:`~AnyButton.SetBitmapFocus` .. attribute:: BitmapLabel See :meth:`~AnyButton.GetBitmapLabel` and :meth:`~AnyButton.SetBitmapLabel` .. attribute:: BitmapMargins See :meth:`~AnyButton.GetBitmapMargins` and :meth:`~AnyButton.SetBitmapMargins` .. attribute:: BitmapPressed See :meth:`~AnyButton.GetBitmapPressed` and :meth:`~AnyButton.SetBitmapPressed`