.. 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 .. _wx.AnyButton: ========================================================================================================================================== |phoenix_title| **wx.AnyButton** ========================================================================================================================================== A class for common button functionality used as the base for the various button classes. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class AnyButton:
| |sub_classes| Known Subclasses ============================== :ref:`wx.Button`, :ref:`wx.ToggleButton` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.AnyButton.__init__` :meth:`~wx.AnyButton.GetBitmap` Return the bitmap shown by the button. :meth:`~wx.AnyButton.GetBitmapCurrent` Returns the bitmap used when the mouse is over the button. :meth:`~wx.AnyButton.GetBitmapDisabled` Returns the bitmap used for the disabled state. :meth:`~wx.AnyButton.GetBitmapFocus` Returns the bitmap used for the focused state. :meth:`~wx.AnyButton.GetBitmapLabel` Returns the bitmap for the normal state. :meth:`~wx.AnyButton.GetBitmapMargins` Get the margins between the bitmap and the text of the button. :meth:`~wx.AnyButton.GetBitmapPressed` Returns the bitmap used when the button is pressed. :meth:`~wx.AnyButton.SetBitmap` Sets the bitmap to display in the button. :meth:`~wx.AnyButton.SetBitmapCurrent` Sets the bitmap to be shown when the mouse is over the button. :meth:`~wx.AnyButton.SetBitmapDisabled` Sets the bitmap for the disabled button appearance. :meth:`~wx.AnyButton.SetBitmapFocus` Sets the bitmap for the button appearance when it has the keyboard focus. :meth:`~wx.AnyButton.SetBitmapLabel` Sets the bitmap label for the button. :meth:`~wx.AnyButton.SetBitmapMargins` Set the margins between the bitmap and the text of the button. :meth:`~wx.AnyButton.SetBitmapPosition` Set the position at which the bitmap is displayed. :meth:`~wx.AnyButton.SetBitmapPressed` Sets the bitmap for the selected (depressed) button appearance. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.AnyButton.Bitmap` See :meth:`~wx.AnyButton.GetBitmap` and :meth:`~wx.AnyButton.SetBitmap` :attr:`~wx.AnyButton.BitmapCurrent` See :meth:`~wx.AnyButton.GetBitmapCurrent` and :meth:`~wx.AnyButton.SetBitmapCurrent` :attr:`~wx.AnyButton.BitmapDisabled` See :meth:`~wx.AnyButton.GetBitmapDisabled` and :meth:`~wx.AnyButton.SetBitmapDisabled` :attr:`~wx.AnyButton.BitmapFocus` See :meth:`~wx.AnyButton.GetBitmapFocus` and :meth:`~wx.AnyButton.SetBitmapFocus` :attr:`~wx.AnyButton.BitmapLabel` See :meth:`~wx.AnyButton.GetBitmapLabel` and :meth:`~wx.AnyButton.SetBitmapLabel` :attr:`~wx.AnyButton.BitmapMargins` See :meth:`~wx.AnyButton.GetBitmapMargins` and :meth:`~wx.AnyButton.SetBitmapMargins` :attr:`~wx.AnyButton.BitmapPressed` See :meth:`~wx.AnyButton.GetBitmapPressed` and :meth:`~wx.AnyButton.SetBitmapPressed` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.AnyButton(Control) **Possible constructors**:: AnyButton() A class for common button functionality used as the base for the various button classes. .. 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:`wx.Bitmap` .. versionadded:: 2.9.1 .. seealso:: :meth:`SetBitmap` .. method:: GetBitmapCurrent(self) Returns the bitmap used when the mouse is over the button. The returned bitmap is only valid if :meth:`SetBitmapCurrent` had been previously called. :rtype: :ref:`wx.Bitmap` .. versionadded:: 2.9.1 (available as `BitmapButton.GetBitmapHover()` in previous versions) .. method:: GetBitmapDisabled(self) Returns the bitmap used for the disabled state. The returned bitmap is only valid if :meth:`SetBitmapDisabled` had been previously called. :rtype: :ref:`wx.Bitmap` .. versionadded:: 2.9.1 (available in :ref:`wx.BitmapButton` only in previous versions) .. method:: GetBitmapFocus(self) Returns the bitmap used for the focused state. The returned bitmap is only valid if :meth:`SetBitmapFocus` had been previously called. :rtype: :ref:`wx.Bitmap` .. versionadded:: 2.9.1 (available in :ref:`wx.BitmapButton` only in previous versions) .. 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:`wx.BitmapButton`. :rtype: :ref:`wx.Bitmap` .. versionadded:: 2.9.1 (available in :ref:`wx.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:`wx.Size` .. versionadded:: 2.9.1 .. seealso:: :meth:`SetBitmapMargins` .. method:: GetBitmapPressed(self) Returns the bitmap used when the button is pressed. The returned bitmap is only valid if :meth:`SetBitmapPressed` had been previously called. :rtype: :ref:`wx.Bitmap` .. versionadded:: 2.9.1 (available as `BitmapButton.GetBitmapSelected()` in previous versions) .. 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 bundle containing the resolution-dependent bitmaps to display in the button. At default ``DPI``, the size of the bitmap is determined by the default bundle size, i.e. the value returned from :meth:`wx.BitmapBundle.GetDefaultSize` . If the bitmap bundle is invalid, any currently shown bitmaps are removed from the button. :type `bitmap`: wx.BitmapBundle :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 ``wx.RIGHT``, ``wx.TOP`` and ``wx.BOTTOM``. :type `dir`: wx.DataObject.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. If `bitmap` is invalid, the normal bitmap will be used in the current state. :param `bitmap`: :type `bitmap`: wx.BitmapBundle .. 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. If `bitmap` is invalid, the disabled bitmap is set to the automatically generated greyed out version of the normal bitmap, i.e. the same bitmap as is used by default if this method is not called at all. Use :meth:`SetBitmap` with an invalid bitmap to remove the bitmap completely (for all states). :param `bitmap`: :type `bitmap`: wx.BitmapBundle .. versionadded:: 2.9.1 (available in :ref:`wx.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. If `bitmap` is invalid, the normal bitmap will be used in the focused state. :param `bitmap`: :type `bitmap`: wx.BitmapBundle .. versionadded:: 2.9.1 (available in :ref:`wx.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`: wx.BitmapBundle .. versionadded:: 2.9.1 (available in :ref:`wx.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: :html:`

` **SetBitmapMargins** `(self, x, y)` :param `x`: :type `x`: int :param `y`: :type `y`: int :html:`

` **SetBitmapMargins** `(self, sz)` :param `sz`: :type `sz`: wx.Size :html:`

` .. 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 ``wx.LEFT``, ``wx.RIGHT``, ``wx.TOP`` or ``wx.BOTTOM``. :type `dir`: wx.DataObject.Direction .. versionadded:: 2.9.1 .. method:: SetBitmapPressed(self, bitmap) Sets the bitmap for the selected (depressed) button appearance. :param `bitmap`: :type `bitmap`: wx.BitmapBundle .. versionadded:: 2.9.1 (available as `BitmapButton.SetBitmapSelected()` in previous versions) .. attribute:: Bitmap See :meth:`~wx.AnyButton.GetBitmap` and :meth:`~wx.AnyButton.SetBitmap` .. attribute:: BitmapCurrent See :meth:`~wx.AnyButton.GetBitmapCurrent` and :meth:`~wx.AnyButton.SetBitmapCurrent` .. attribute:: BitmapDisabled See :meth:`~wx.AnyButton.GetBitmapDisabled` and :meth:`~wx.AnyButton.SetBitmapDisabled` .. attribute:: BitmapFocus See :meth:`~wx.AnyButton.GetBitmapFocus` and :meth:`~wx.AnyButton.SetBitmapFocus` .. attribute:: BitmapLabel See :meth:`~wx.AnyButton.GetBitmapLabel` and :meth:`~wx.AnyButton.SetBitmapLabel` .. attribute:: BitmapMargins See :meth:`~wx.AnyButton.GetBitmapMargins` and :meth:`~wx.AnyButton.SetBitmapMargins` .. attribute:: BitmapPressed See :meth:`~wx.AnyButton.GetBitmapPressed` and :meth:`~wx.AnyButton.SetBitmapPressed`