.. 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.StaticBitmap: ========================================================================================================================================== |phoenix_title| **wx.StaticBitmap** ========================================================================================================================================== A static bitmap control displays a bitmap. Native implementations on some platforms are only meant for display of the small icons in the dialog boxes. If you want to display larger images portably, you may use generic implementation GenericStaticBitmap declared in . Notice that for the best results, the size of the control should be the same as the size of the image displayed in it, as happens by default if it's not resized explicitly. Otherwise, behaviour depends on the platform: under MSW, the bitmap is drawn centred inside the control, while elsewhere it is drawn at the origin of the control. You can use :meth:`~wx.StaticBitmap.SetScaleMode` to control how the image is scaled inside the control. .. seealso:: :ref:`wx.Bitmap` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class StaticBitmap:
| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/wx.staticbitmap.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: _static/images/widgets/fullsize/wxmac/wx.staticbitmap.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: _static/images/widgets/fullsize/wxgtk/wx.staticbitmap.png :alt: wxGTK :figclass: floatcenter **wxGTK** | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.StaticBitmap.__init__` Default constructor. :meth:`~wx.StaticBitmap.Create` Creation function, for two-step construction. :meth:`~wx.StaticBitmap.GetBitmap` Returns the bitmap currently used in the control. :meth:`~wx.StaticBitmap.GetClassDefaultAttributes` :meth:`~wx.StaticBitmap.GetIcon` Returns the icon currently used in the control. :meth:`~wx.StaticBitmap.GetScaleMode` Returns the scale mode currently used in the control. :meth:`~wx.StaticBitmap.SetBitmap` Sets the bitmap label. :meth:`~wx.StaticBitmap.SetIcon` Sets the label to the given icon. :meth:`~wx.StaticBitmap.SetScaleMode` Sets the scale mode. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.StaticBitmap.Bitmap` See :meth:`~wx.StaticBitmap.GetBitmap` and :meth:`~wx.StaticBitmap.SetBitmap` :attr:`~wx.StaticBitmap.Icon` See :meth:`~wx.StaticBitmap.GetIcon` and :meth:`~wx.StaticBitmap.SetIcon` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.StaticBitmap(Control) **Possible constructors**:: StaticBitmap() StaticBitmap(parent, id=ID_ANY, bitmap=NullBitmap, pos=DefaultPosition, size=DefaultSize, style=0, name=StaticBitmapNameStr) A static bitmap control displays a bitmap. .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **__init__** `(self)` Default constructor. :html:`

` **__init__** `(self, parent, id=ID_ANY, bitmap=NullBitmap, pos=DefaultPosition, size=DefaultSize, style=0, name=StaticBitmapNameStr)` Constructor, creating and showing a static bitmap control. :param `parent`: Parent window. Should not be ``None``. :type `parent`: wx.Window :param `id`: Control identifier. A value of -1 denotes a default value. :type `id`: wx.WindowID :param `bitmap`: :type `bitmap`: wx.BitmapBundle :param `pos`: Window position. :type `pos`: wx.Point :param `size`: Window size. :type `size`: wx.Size :param `style`: Window style. See :ref:`wx.StaticBitmap`. :type `style`: long :param `name`: Window name. :type `name`: string Bitmap label. .. seealso:: :meth:`Create` :html:`

` .. method:: Create(self, parent, id=ID_ANY, bitmap=NullBitmap, pos=DefaultPosition, size=DefaultSize, style=0, name=StaticBitmapNameStr) Creation function, for two-step construction. For details see :ref:`wx.StaticBitmap`. :param `parent`: :type `parent`: wx.Window :param `id`: :type `id`: wx.WindowID :param `bitmap`: :type `bitmap`: wx.BitmapBundle :param `pos`: :type `pos`: wx.Point :param `size`: :type `size`: wx.Size :param `style`: :type `style`: long :param `name`: :type `name`: string :rtype: `bool` .. method:: GetBitmap(self) Returns the bitmap currently used in the control. Notice that this method can be called even if :meth:`SetIcon` had been used. :rtype: :ref:`wx.Bitmap` .. seealso:: :meth:`SetBitmap` .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) :param `variant`: :type `variant`: wx.WindowVariant :rtype: :ref:`wx.VisualAttributes` .. method:: GetIcon(self) Returns the icon currently used in the control. Notice that this method can only be called if :meth:`SetIcon` had been used: an icon can't be retrieved from the control if a bitmap had been set (using :meth:`wx.StaticBitmap.SetBitmap` ). :rtype: :ref:`wx.Icon` .. seealso:: :meth:`SetIcon` .. method:: GetScaleMode(self) Returns the scale mode currently used in the control. :rtype: :ref:`wx.GenericStaticBitmap.ScaleMode` .. versionadded:: 4.1/wxWidgets-3.1.0 .. seealso:: :meth:`SetScaleMode` .. method:: SetBitmap(self, label) Sets the bitmap label. :param `label`: The new bitmap. :type `label`: wx.BitmapBundle .. seealso:: :meth:`GetBitmap` .. method:: SetIcon(self, label) Sets the label to the given icon. :param `label`: The new icon. :type `label`: wx.Icon .. method:: SetScaleMode(self, scaleMode) Sets the scale mode. :param `scaleMode`: Controls how the bitmap is scaled inside the control. :type `scaleMode`: wx.GenericStaticBitmap.ScaleMode .. versionadded:: 4.1/wxWidgets-3.1.0 .. note:: Currently only the generic implementation supports all scaling modes. You may use generic implementation GenericStaticBitmap declared in in all ports. .. seealso:: :meth:`GetScaleMode` .. attribute:: Bitmap See :meth:`~wx.StaticBitmap.GetBitmap` and :meth:`~wx.StaticBitmap.SetBitmap` .. attribute:: Icon See :meth:`~wx.StaticBitmap.GetIcon` and :meth:`~wx.StaticBitmap.SetIcon` .. toctree:: :maxdepth: 1 :hidden: wx.GenericStaticBitmap.ScaleMode.enumeration