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.
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. |
|
See |
|
See |
wx.
Caret
(object)¶Possible constructors:
Caret(window, width, height)
Caret(window, size)
Caret()
A caret is a blinking cursor showing the position where the typed text will appear.
__init__
(self, *args, **kw)¶__init__ (self, window, width, height)
Creates a caret with the given size (in pixels) and associates it with the window.
window (wx.Window) –
width (int) –
height (int) –
__init__ (self, window, size)
Creates a caret with the given size (in pixels) and associates it with the window.
__init__ (self)
Default constructor.
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)
window (wx.Window) –
width (int) –
height (int) –
bool
Create (self, window, size)
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).
int
GetPosition
(self)¶Get the caret position (in pixels).
GetSize
(self)¶Get the caret size.
Hide
(self)¶Hides the caret, same as Show(false).
IsOk
(self)¶Returns True
if the caret was created successfully.
bool
IsVisible
(self)¶Returns True
if the caret is visible and False
if it is permanently hidden (if it is blinking and not shown currently but will be after the next blink, this method still returns True
).
bool
Move
(self, *args, **kw)¶Move the caret to given position (in logical coordinates).
Move (self, x, y)
x (int) –
y (int) –
Move (self, pt)
pt (wx.Point) –
SetBlinkTime
(milliseconds)¶Sets the blink time for all the carets.
milliseconds (int) –
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)
width (int) –
height (int) –
SetSize (self, size)
size (wx.Size) –
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.
show (bool) –
__bool__
(self)¶int
__nonzero__
(self)¶int
Position
¶See GetPosition