.. 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.expando .. highlight:: python .. _wx.lib.expando.ExpandoTextCtrl: ========================================================================================================================================== |phoenix_title| **wx.lib.expando.ExpandoTextCtrl** ========================================================================================================================================== The ExpandoTextCtrl is a multi-line wx.TextCtrl that will adjust its height on the fly as needed to accommodate the number of lines needed to display the current content of the control. It is assumed that the width of the control will be a fixed value and that only the height will be adjusted automatically. If the control is used in a sizer then the width should be set as part of the initial or min size of the control. When the control resizes itself it will attempt to also make necessary adjustments in the sizer hierarchy it is a member of (if any) but if that is not suffiecient then the programmer can catch the EVT_ETC_LAYOUT_NEEDED event in the container and make any other layout adjustments that may be needed. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class ExpandoTextCtrl:
| |sub_classes| Known Subclasses ============================== :class:`wx.lib.agw.aui.auibook.TabTextCtrl`, :class:`wx.lib.agw.customtreectrl.TreeTextCtrl`, :class:`wx.lib.agw.ultimatelistctrl.UltimateListTextCtrl` | |super_classes| Known Superclasses ================================== :class:`wx.TextCtrl` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.expando.ExpandoTextCtrl.__init__` Default class constructor. :meth:`~wx.lib.expando.ExpandoTextCtrl.AppendText` Appends the text to the end of the text control. :meth:`~wx.lib.expando.ExpandoTextCtrl.GetMaxHeight` Returns the maximum height that the control will expand to on its own. :meth:`~wx.lib.expando.ExpandoTextCtrl.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`ExpandoTextCtrl`. :meth:`~wx.lib.expando.ExpandoTextCtrl.OnTextChanged` Handles the ``wx.EVT_TEXT`` event for :class:`ExpandoTextCtrl`. :meth:`~wx.lib.expando.ExpandoTextCtrl.SetFont` Sets the font for the :class:`ExpandoTextCtrl`. :meth:`~wx.lib.expando.ExpandoTextCtrl.SetMaxHeight` Sets the maximum height that the control will expand to on its :meth:`~wx.lib.expando.ExpandoTextCtrl.WriteText` Writes the text into the text control at the current insertion position. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: ExpandoTextCtrl(wx.TextCtrl) The ExpandoTextCtrl is a multi-line wx.TextCtrl that will adjust its height on the fly as needed to accommodate the number of lines needed to display the current content of the control. It is assumed that the width of the control will be a fixed value and that only the height will be adjusted automatically. If the control is used in a sizer then the width should be set as part of the initial or min size of the control. When the control resizes itself it will attempt to also make necessary adjustments in the sizer hierarchy it is a member of (if any) but if that is not suffiecient then the programmer can catch the EVT_ETC_LAYOUT_NEEDED event in the container and make any other layout adjustments that may be needed. .. method:: __init__(self, parent, id=-1, value="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name="expando") Default class constructor. :param `parent`: parent window, must not be ``None``; :param integer `id`: window identifier. A value of -1 indicates a default value; :param string `value`: the control 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 integer `style`: the underlying :class:`wx.Control` style; :param wx.Validator `validator`: the window validator; :param string `name`: the widget name. :type parent: :class:`wx.Window` :type pos: tuple or :class:`wx.Point` :type size: tuple or :class:`wx.Size` .. method:: AppendText(self, text) Appends the text to the end of the text control. :param string `text`: text to write to the text control. .. seealso:: :meth:`WriteText` .. method:: GetMaxHeight(self) Returns the maximum height that the control will expand to on its own. :rtype: int .. method:: OnSize(self, evt) Handles the ``wx.EVT_SIZE`` event for :class:`ExpandoTextCtrl`. :param `event`: a :class:`wx.SizeEvent` event to be processed. .. method:: OnTextChanged(self, evt) Handles the ``wx.EVT_TEXT`` event for :class:`ExpandoTextCtrl`. :param `event`: a :class:`CommandEvent` event to be processed. .. method:: SetFont(self, font) Sets the font for the :class:`ExpandoTextCtrl`. :param wx.Font font: font to associate with the :class:`ExpandoTextCtrl`, pass ``NullFont`` to reset to the default font. :rtype: bool :returns: ``True`` if the font was really changed, ``False`` if it was already set to this font and nothing was done. .. method:: SetMaxHeight(self, h) Sets the maximum height that the control will expand to on its own, and adjusts it down if needed. :param integer `h`: the maximum control height, in pixels. .. method:: WriteText(self, text) Writes the text into the text control at the current insertion position. :param string `text`: text to write to the text control. .. note:: Newlines in the text string are the only control characters allowed, and they will cause appropriate line breaks. See :meth:`AppendText` for more convenient ways of writing to the window. After the write operation, the insertion point will be at the end of the inserted text, so subsequent write operations will be appended. To append text after the user may have interacted with the control, call :meth:`TextCtrl.SetInsertionPointEnd` before writing.