.. 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, width, height) Caret(window, size) Caret() 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, width, height)` 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 :html:`

` **__init__** `(self, window, 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 :html:`

` **__init__** `(self)` Default constructor. :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, width, height)` :param `window`: :type `window`: wx.Window :param `width`: :type `width`: int :param `height`: :type `height`: int :rtype: `bool` :html:`

` **Create** `(self, window, 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). .. 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, y)` :param `x`: :type `x`: int :param `y`: :type `y`: int :html:`

` **Move** `(self, pt)` :param `pt`: :type `pt`: wx.Point :html:`

` .. staticmethod:: SetBlinkTime(milliseconds) Sets the blink time for all the carets. :param `milliseconds`: :type `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. .. seealso:: :meth:`GetBlinkTime` .. method:: SetSize(self, *args, **kw) Changes the size of the caret. |overload| Overloaded Implementations: :html:`

` **SetSize** `(self, width, height)` :param `width`: :type `width`: int :param `height`: :type `height`: int :html:`

` **SetSize** `(self, size)` :param `size`: :type `size`: wx.Size :html:`

` .. method:: 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. :param `show`: :type `show`: bool .. 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`