.. wxPython Phoenix documentation

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

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

.. include:: headings.inc

.. currentmodule:: wx.lib.agw.infobar

.. highlight:: python



.. _wx.lib.agw.infobar.AutoWrapStaticText:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.infobar.AutoWrapStaticText**
==========================================================================================================================================

A simple class derived from :mod:`lib.stattext` that implements auto-wrapping
behaviour depending on the parent size.

.. versionadded:: 0.9.5



|

|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>AutoWrapStaticText</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.infobar.AutoWrapStaticText_inheritance.png" alt="Inheritance diagram of AutoWrapStaticText" 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.infobar.AutoWrapStaticText.html" title="A simple class derived from lib.stattext that implements auto-wrapping" alt="" coords="5,469,288,499"/> <area shape="rect" id="node2" href="wx.lib.stattext.GenStaticText.html" title="GenStaticText is a generic implementation of wx.StaticText." alt="" coords="39,392,255,421"/> <area shape="rect" id="node3" href="wx.Control.html" title="This is the base class for a control or 'widget'." alt="" coords="100,315,193,344"/> <area shape="rect" id="node4" href="wx.Window.html" title="wx.Window  is the base class for all windows and represents any visible object on screen." alt="" coords="98,237,195,267"/> <area shape="rect" id="node5" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="81,160,212,189"/> <area shape="rect" id="node6" href="wx.EvtHandler.html" title="A class that can handle events from the windowing system." alt="" coords="87,83,206,112"/> <area shape="rect" id="node7" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="41,5,129,35"/> <area shape="rect" id="node8" href="wx.Trackable.html" title="Add-on base class for a trackable object." alt="" coords="154,5,265,35"/> </map> 
   </p>
   </div>

|


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

:class:`wx.lib.stattext.GenStaticText`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.agw.infobar.AutoWrapStaticText.__init__`                          Defsult class constructor.
:meth:`~wx.lib.agw.infobar.AutoWrapStaticText.OnSize`                            Handles the ``wx.EVT_SIZE`` event for :class:`AutoWrapStaticText`.
:meth:`~wx.lib.agw.infobar.AutoWrapStaticText.SetLabel`                          Sets the :class:`AutoWrapStaticText` label.
:meth:`~wx.lib.agw.infobar.AutoWrapStaticText.Wrap`                              This functions wraps the controls label so that each of its lines becomes at
================================================================================ ================================================================================


|


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


.. class:: AutoWrapStaticText(StaticText)

   A simple class derived from :mod:`lib.stattext` that implements auto-wrapping
   behaviour depending on the parent size.
   
   .. versionadded:: 0.9.5

   .. method:: __init__(self, parent, label)

      Defsult class constructor.
      
      :param wx.Window parent: a subclass of :class:`wx.Window`, must not be ``None``;
      :param string `label`: the :class:`AutoWrapStaticText` text label.


   .. method:: OnSize(self, event)

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


   .. method:: SetLabel(self, label, wrapped=False)

      Sets the :class:`AutoWrapStaticText` label.
      
      All "&" characters in the label are special and indicate that the following character is
      a mnemonic for this control and can be used to activate it from the keyboard (typically
      by using ``Alt`` key in combination with it). To insert a literal ampersand character, you
      need to double it, i.e. use "&&". If this behaviour is undesirable, use :meth:`~Control.SetLabelText` instead.
      
      :param string `label`: the new :class:`AutoWrapStaticText` text label;
      :param bool `wrapped`: ``True`` if this method was called by the developer using :meth:`~AutoWrapStaticText.SetLabel`,
       ``False`` if it comes from the :meth:`~AutoWrapStaticText.OnSize` event handler.
      
      .. note:: Reimplemented from :class:`wx.Control`.


   .. method:: Wrap(self, width)

      This functions wraps the controls label so that each of its lines becomes at
      most `width` pixels wide if possible (the lines are broken at words boundaries
      so it might not be the case if words are too long).
      
      If `width` is negative, no wrapping is done.
      
      :param integer `width`: the maximum available width for the text, in pixels.
      
      .. note:: Note that this `width` is not necessarily the total width of the control,
       since a few pixels for the border (depending on the controls border style) may be added.