.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.Caret:
==========================================================================================================================================
|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 :ref:`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 :meth:`wx.Window.GetCaret` . The same caret can't be reused in two different windows.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
Caret:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.Caret.__init__` Creates a caret with the given size (in pixels) and associates it with the `window`.
:meth:`~wx.Caret.Create` Creates a caret with the given size (in pixels) and associates it with the `window` (same as the equivalent constructors).
:meth:`~wx.Caret.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).
:meth:`~wx.Caret.GetPosition` Get the caret position (in pixels).
:meth:`~wx.Caret.GetSize` Get the caret size.
:meth:`~wx.Caret.GetWindow` Get the window the caret is associated with.
:meth:`~wx.Caret.Hide` Hides the caret, same as Show(false).
:meth:`~wx.Caret.IsOk` Returns ``True`` if the caret was created successfully.
:meth:`~wx.Caret.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``).
:meth:`~wx.Caret.Move` Move the caret to given position (in logical coordinates).
:meth:`~wx.Caret.SetBlinkTime` Sets the blink time for all the carets.
:meth:`~wx.Caret.SetSize` Changes the size of the caret.
:meth:`~wx.Caret.Show` Shows or hides the caret.
:meth:`~wx.Caret.__bool__`
:meth:`~wx.Caret.__nonzero__`
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.Caret.Position` See :meth:`~wx.Caret.GetPosition`
:attr:`~wx.Caret.Size` See :meth:`~wx.Caret.GetSize` and :meth:`~wx.Caret.SetSize`
:attr:`~wx.Caret.Window` See :meth:`~wx.Caret.GetWindow`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.Caret(object)
**Possible constructors**::
Caret(window : Window, width : int, height : int) -> None
Caret(window : Window, size : Size) -> None
Caret() -> None
A caret is a blinking cursor showing the position where the typed text
will appear.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self, window : Window, width : int, height : int)`
Creates a caret with the given size (in pixels) and associates it with the `window`.
:param `window`:
:type `window`: wx.Window
:param `width`:
:type `width`: int
:param `height`:
:type `height`: int
:rtype: `None`
:html:`
`
**__init__** `(self, window : Window, size : Size)`
Creates a caret with the given size (in pixels) and associates it with the `window`.
:param `window`:
:type `window`: wx.Window
:param `size`:
:type `size`: wx.Size
:rtype: `None`
:html:`
`
**__init__** `(self)`
Default constructor.
:rtype: `None`
:html:`
`
.. method:: 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:**
:html:`
`
**Create** `(self, window : Window, width : int, height : int)`
:param `window`:
:type `window`: wx.Window
:param `width`:
:type `width`: int
:param `height`:
:type `height`: int
:rtype: `bool`
:html:`
`
**Create** `(self, window : Window, size : Size)`
:param `window`:
:type `window`: wx.Window
:param `size`:
:type `size`: wx.Size
:rtype: `bool`
:html:`
`
.. staticmethod:: 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).
:rtype: `int`
.. method:: GetPosition(self)
Get the caret position (in pixels).
.. method:: GetSize(self)
Get the caret size.
.. method:: GetWindow(self)
Get the window the caret is associated with.
:rtype: :ref:`wx.Window`
.. method:: Hide(self)
Hides the caret, same as Show(false).
:rtype: `None`
.. method:: IsOk(self)
Returns ``True`` if the caret was created successfully.
:rtype: `bool`
.. method:: 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``).
:rtype: `bool`
.. method:: Move(self, *args, **kw)
Move the caret to given position (in logical coordinates).
|overload| **Overloaded Implementations:**
:html:`
`
**Move** `(self, x : int, y : int)`
:param `x`:
:type `x`: int
:param `y`:
:type `y`: int
:rtype: `None`
:html:`
`
**Move** `(self, pt : Point)`
:param `pt`:
:type `pt`: wx.Point
:rtype: `None`
:html:`
`
.. staticmethod:: SetBlinkTime(milliseconds : int)
Sets the blink time for all the carets.
:param `milliseconds`:
:type `milliseconds`: int
:rtype: `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.
.. seealso:: :meth:`GetBlinkTime`
.. method:: SetSize(self, *args, **kw)
Changes the size of the caret.
|overload| **Overloaded Implementations:**
:html:`
`
**SetSize** `(self, width : int, height : int)`
:param `width`:
:type `width`: int
:param `height`:
:type `height`: int
:rtype: `None`
:html:`
`
**SetSize** `(self, size : Size)`
:param `size`:
:type `size`: wx.Size
:rtype: `None`
:html:`
`
.. method:: Show(self, show: bool=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.
:param `show`:
:type `show`: bool
:rtype: `None`
.. method:: __bool__(self)
:rtype: `int`
.. method:: __nonzero__(self)
:rtype: `int`
.. attribute:: Position
See :meth:`~wx.Caret.GetPosition`
.. attribute:: Size
See :meth:`~wx.Caret.GetSize` and :meth:`~wx.Caret.SetSize`
.. attribute:: Window
See :meth:`~wx.Caret.GetWindow`