The ExpandoTextCtrl is a multi-line wx.TextCtrl that will adjust its height on the fly as needed to accomodate 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.
wx.lib.agw.aui.auibook.TabTextCtrl
, wx.lib.agw.customtreectrl.TreeTextCtrl
, wx.lib.agw.ultimatelistctrl.UltimateListTextCtrl
__init__ |
Default class constructor. |
AppendText |
Appends the text to the end of the text control. |
GetMaxHeight |
Returns the maximum height that the control will expand to on its own. |
OnSize |
Handles the wx.EVT_SIZE event for ExpandoTextCtrl . |
OnTextChanged |
Handles the wx.EVT_TEXT event for ExpandoTextCtrl . |
SetFont |
Sets the font for the ExpandoTextCtrl . |
SetMaxHeight |
Sets the maximum height that the control will expand to on its |
WriteText |
Writes the text into the text control at the current insertion position. |
ExpandoTextCtrl
(wx.TextCtrl)¶The ExpandoTextCtrl is a multi-line wx.TextCtrl that will adjust its height on the fly as needed to accomodate 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.
__init__
(self, parent, id=-1, value="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name="expando")¶Default class constructor.
Parameters: |
|
---|
AppendText
(self, text)¶Appends the text to the end of the text control.
Parameters: | text (string) – text to write to the text control. |
---|
See also
GetMaxHeight
(self)¶Returns the maximum height that the control will expand to on its own.
Return type: | int |
---|
OnSize
(self, evt)¶Handles the wx.EVT_SIZE
event for ExpandoTextCtrl
.
Parameters: | event – a wx.SizeEvent event to be processed. |
---|
OnTextChanged
(self, evt)¶Handles the wx.EVT_TEXT
event for ExpandoTextCtrl
.
Parameters: | event – a CommandEvent event to be processed. |
---|
SetFont
(self, font)¶Sets the font for the ExpandoTextCtrl
.
Parameters: | font (wx.Font) – font to associate with the ExpandoTextCtrl , pass
NullFont to reset to the default font. |
---|---|
Return type: | bool |
Returns: | True if the font was really changed, False if it was already
set to this font and nothing was done. |
SetMaxHeight
(self, h)¶Sets the maximum height that the control will expand to on its own, and adjusts it down if needed.
Parameters: | h (integer) – the maximum control height, in pixels. |
---|
WriteText
(self, text)¶Writes the text into the text control at the current insertion position.
Parameters: | text (string) – 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 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 TextCtrl.SetInsertionPointEnd
before writing.