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

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Caret</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.Caret_inheritance.png" alt="Inheritance diagram of Caret" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Caret.html" title="wx.Caret" alt="" coords="5,5,85,35"/> </map> 
   </p>
   </div>

|


|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:`<hr class="overloadsep" /><br />`

      
      **__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:`<hr class="overloadsep" /><br />`

      
      **__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:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Default constructor.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. 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:`<hr class="overloadsep" /><br />`

      
      **Create** `(self, window, width, height)`
      
      
      
      
      :param `window`: 
      :type `window`: wx.Window
      :param `width`: 
      :type `width`: int
      :param `height`: 
      :type `height`: int
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **Create** `(self, window, size)`
      
      
      
      
      :param `window`: 
      :type `window`: wx.Window
      :param `size`: 
      :type `size`: wx.Size
      
      
      
      
      :rtype: `bool`
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. 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:`<hr class="overloadsep" /><br />`

      
      **Move** `(self, x, y)`
      
      
      
      
      :param `x`: 
      :type `x`: int
      :param `y`: 
      :type `y`: int
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **Move** `(self, pt)`
      
      
      
      
      :param `pt`: 
      :type `pt`: wx.Point
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. 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:`<hr class="overloadsep" /><br />`

      
      **SetSize** `(self, width, height)`
      
      
      
      
      :param `width`: 
      :type `width`: int
      :param `height`: 
      :type `height`: int
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **SetSize** `(self, size)`
      
      
      
      
      :param `size`: 
      :type `size`: wx.Size
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






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

