wx.Caret¶
A caret is a blinking cursor showing the position where the typed text will appear.
Text controls usually have their own caret but wx.Caret provides a way to use a caret in other windows.
Currently, the caret appears as a rectangle of the given size. In the future, it will be possible to specify a bitmap to be used for the caret shape.
A caret is always associated with a window and the current caret can be retrieved using wx.Window.GetCaret
. The same caret can’t be reused in two different windows.
Class Hierarchy¶
Methods Summary¶
Creates a caret with the given size (in pixels) and associates it with the window. |
|
Creates a caret with the given size (in pixels) and associates it with the window (same as the equivalent constructors). |
|
Returns the blink time which is measured in milliseconds and is the time elapsed between 2 inversions of the caret (blink time of the caret is the same for all carets, so this functions is static). |
|
Get the caret position (in pixels). |
|
Get the caret size. |
|
Get the window the caret is associated with. |
|
Hides the caret, same as Show(false). |
|
Returns |
|
Returns |
|
Move the caret to given position (in logical coordinates). |
|
Sets the blink time for all the carets. |
|
Changes the size of the caret. |
|
Shows or hides the caret. |
|
Properties Summary¶
See |
|
See |
Class API¶
- class wx.Caret(object)¶
Possible constructors:
Caret(window, width, height) -> None Caret(window, size) -> None Caret() -> None
A caret is a blinking cursor showing the position where the typed text will appear.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self, window, width, height)
Creates a caret with the given size (in pixels) and associates it with the window.
- Parameters:
window (wx.Window)
width (int)
height (int)
- Return type:
None
__init__ (self, window, size)
Creates a caret with the given size (in pixels) and associates it with the window.
__init__ (self)
Default constructor.
- Return type:
None
- Create(self, *args, **kw)¶
Creates a caret with the given size (in pixels) and associates it with the window (same as the equivalent constructors).
Create (self, window, width, height)
- Parameters:
window (wx.Window)
width (int)
height (int)
- Return type:
bool
Create (self, window, size)
- static GetBlinkTime()¶
Returns the blink time which is measured in milliseconds and is the time elapsed between 2 inversions of the caret (blink time of the caret is the same for all carets, so this functions is static).
- Return type:
int
- GetPosition(self)¶
Get the caret position (in pixels).
- GetSize(self)¶
Get the caret size.
- Hide(self)¶
Hides the caret, same as Show(false).
- Return type:
None
- IsOk(self)¶
Returns
True
if the caret was created successfully.- Return type:
bool
- IsVisible(self)¶
Returns
True
if the caret is visible andFalse
if it is permanently hidden (if it is blinking and not shown currently but will be after the next blink, this method still returnsTrue
).- Return type:
bool
- Move(self, *args, **kw)¶
Move the caret to given position (in logical coordinates).
Move (self, x, y)
- Parameters:
x (int)
y (int)
- Return type:
None
Move (self, pt)
- Parameters:
pt (wx.Point)
- Return type:
None
- static SetBlinkTime(milliseconds)¶
Sets the blink time for all the carets.
- Parameters:
milliseconds (int)
- Return type:
None
Warning
Under Windows, this function will change the blink time for all carets permanently (until the next time it is called), even for carets in other applications.
See also
- SetSize(self, *args, **kw)¶
Changes the size of the caret.
SetSize (self, width, height)
- Parameters:
width (int)
height (int)
- Return type:
None
SetSize (self, size)
- Parameters:
size (wx.Size)
- Return type:
None
- Show(self, show=True)¶
Shows or hides the caret.
Notice that if the caret was hidden N times, it must be shown N times as well to reappear on the screen.
- Parameters:
show (bool)
- Return type:
None
- __bool__(self)¶
- Return type:
bool
- __nonzero__(self)¶
- Return type:
bool
Properties¶
- Position¶
See
GetPosition