textctrlwrapper
Classes:
Base class for wrappers around |
-
class
TextCtrlWrapper
[source] Bases:
object
Base class for wrappers around
wx.TextCtrl
.Subclasses must set the value of
textctrl
.Methods:
AppendText
(text)Appends the given text to the end of the text control.
CanCopy
()Returns
True
if the selection can be copied to the clipboard.CanCut
()Returns
True
if the selection can be cut to the clipboard.CanPaste
()Returns
True
if the contents of the clipboard can be pasted into the text control.CanRedo
()Returns
True
if there is a redo facility available, and the last operation can be redone.CanUndo
()Returns
True
if there is an undo facility available, and the last operation can be undone.Clear
()Clears the text in the control.
Copy
()Copies the selected text to the clipboard.
Cut
()Copies the selected text to the clipboard and removes it from the control.
Returns the zero based index of the last position in the text control, which is equal to the number of characters in the control.
Gets the current selection span.
Returns the text currently selected in the control.
GetValue
()Gets the contents of the control.
Returns
True
if the controls contents may be edited by user (note that it always can be changed by the program).IsEmpty
()Returns whether the control is currently empty.
Paste
()Pastes the clipboard contents into the control.
Redo
()If there is a redo facility and the last operation can be redone, redoes the last operation.
Remove
(from_, to_)Removes the text starting at the first given position up to (but not including) the character at the last position.
Replace
(from_, to_, value)Replaces the text starting at the first position up to (but not including) the character at the last position with the given text.
Selects all text in the control.
Deselects selected text in the control.
SetSelection
(from_, to_)Selects the text starting at the first position up to (but not including) the character at the last position.
SetValue
(value)Sets the new text control value.
Undo
()If there is an undo facility, and the last operation can be undone, undoes the last operation.
WriteText
(text)Writes the text into the text control at the current insertion position.
Attributes:
The
wx.TextCtrl
being wrapped.-
AppendText
(text)[source] Appends the given text to the end of the text control.
Note
After the text is appended, the insertion point will be at the end of the text control. If this behaviour is not desired, the programmer should use GetInsertionPoint and SetInsertionPoint.
- Parameters
text (
str
)
-
CanPaste
()[source] Returns
True
if the contents of the clipboard can be pasted into the text control.On some platforms (Motif, GTK) this is an approximation and returns
True
if the control is editable,False
otherwise.- Return type
-
CanRedo
()[source] Returns
True
if there is a redo facility available, and the last operation can be redone.- Return type
-
CanUndo
()[source] Returns
True
if there is an undo facility available, and the last operation can be undone.- Return type
-
Clear
()[source] Clears the text in the control.
Note that this function will generate a
wx.wxEVT_TEXT
event, i.e. its effect is identical to callingSetValue('')
.
-
GetLastPosition
()[source] Returns the zero based index of the last position in the text control, which is equal to the number of characters in the control.
- Return type
wx.TextPos
-
GetSelection
()[source] Gets the current selection span.
If the returned values are equal, there was no selection.
Note
The indices returned may be used with the other
wx.TextCtrl
methods but don’t necessarily represent the correct indices into the string returned by GetValue for multiline controls under Windows (at least,) you should use GetStringSelection to get the selected text.
-
GetStringSelection
()[source] Returns the text currently selected in the control.
If there is no selection, the returned string is empty.
- Return type
-
GetValue
()[source] Gets the contents of the control.
Note
For a multiline text control, the lines will be separated by (Unix-style)
\n
characters, even under Windows where they are separated by a\r\n
sequence in the native control.- Return type
-
IsEditable
()[source] Returns
True
if the controls contents may be edited by user (note that it always can be changed by the program).In other words, this functions returns
True
if the control hasn’t been put in read-only mode by a previous call toSetEditable()
.- Return type
-
Redo
()[source] If there is a redo facility and the last operation can be redone, redoes the last operation.
Does nothing if there is no redo facility.
-
Remove
(from_, to_)[source] Removes the text starting at the first given position up to (but not including) the character at the last position.
This function puts the current insertion point position at to as a side effect.
-
Replace
(from_, to_, value)[source] Replaces the text starting at the first position up to (but not including) the character at the last position with the given text.
This function puts the current insertion point position at to as a side effect.
-
SetSelection
(from_, to_)[source] Selects the text starting at the first position up to (but not including) the character at the last position.
If both parameters are equal to -1 all text in the control is selected.
Notice that the insertion point will be moved to from by this function.
-
SetValue
(value)[source] Sets the new text control value.
It also marks the control as not-modified which means that
IsModified()
would returnFalse
immediately after the call toSetValue()
.The insertion point is set to the start of the control (i.e. position 0) by this function unless the control value doesn’t change at all, in which case the insertion point is left at its original position.
Note
Unlike most other functions changing the control’s values, this function generates a
wx.wxEVT_TEXT
event. To avoid this you can useChangeValue()
instead.- Parameters
value (
str
) – The new value to set. It may contain newline characters if the text control is multiline.
-
Undo
()[source] If there is an undo facility, and the last operation can be undone, undoes the last operation.
Does nothing if there is no undo facility.
-
WriteText
(text)[source] Writes the text into the text control at the current insertion position.
- Parameters
text (
str
) – Text to write to the text control
-
textctrl
Type:
TextCtrl
The
wx.TextCtrl
being wrapped.
-