Phoenix Logo

phoenix_title 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 Class Hierarchy

Inheritance diagram for class Caret:

method_summary Methods Summary

__init__ Creates a caret with the given size (in pixels) and associates it with the window.
Create Creates a caret with the given size (in pixels) and associates it with the window (same as the equivalent constructors).
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).
GetPosition Get the caret position (in pixels).
GetSize Get the caret size.
GetWindow Get the window the caret is associated with.
Hide Hides the caret, same as Show(false).
IsOk Returns True if the caret was created successfully.
IsVisible 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).
Move Move the caret to given position (in logical coordinates).
SetBlinkTime Sets the blink time for all the carets.
SetSize Changes the size of the caret.
Show Shows or hides the caret.
__nonzero__  

property_summary Properties Summary

Position See GetPosition
Size See GetSize and SetSize
Window See GetWindow

api Class API



class 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.


Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__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) –



__init__ (self, window, size)

Creates a caret with the given size (in pixels) and associates it with the window.

Parameters:



__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).

overload Overloaded Implementations:



Create (self, window, width, height)

Parameters:
  • window (wx.Window) –
  • width (int) –
  • height (int) –
Return type:

bool



Create (self, window, size)

Parameters:
Return type:

bool





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.



GetWindow(self)

Get the window the caret is associated with.

Return type: wx.Window


Hide(self)

Hides the caret, same as Show(false).



IsOk(self)

Returns True if the caret was created successfully.

Return type: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).

Return type:bool


Move(self, *args, **kw)

Move the caret to given position (in logical coordinates).

overload Overloaded Implementations:



Move (self, x, y)

Parameters:
  • x (int) –
  • y (int) –



Move (self, pt)

Parameters:pt (wx.Point) –





static SetBlinkTime(milliseconds)

Sets the blink time for all the carets.

Parameters: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

GetBlinkTime



SetSize(self, *args, **kw)

Changes the size of the caret.

overload Overloaded Implementations:



SetSize (self, width, height)

Parameters:
  • width (int) –
  • height (int) –



SetSize (self, size)

Parameters: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.

Parameters:show (bool) –


__nonzero__(self)
Return type:int

Properties



Position

See GetPosition



Size

See GetSize and SetSize



Window

See GetWindow