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

==========================================================================================================================================
|phoenix_title|  **wx.Point**
==========================================================================================================================================

A :ref:`wx.Point`  is a useful data structure for graphics operations.          

It contains integer `x`  and `y`  members. See :ref:`wx.RealPoint`  for a floating point version. 

Note that the width and height stored inside a :ref:`wx.Point`  object may be negative and that :ref:`wx.Point`  functions do not perform any check against negative values (this is used to e.g. store the special -1 value in :ref:`wx.DefaultPosition`  instance). 









         



.. seealso:: :ref:`wx.RealPoint`    







|

|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>Point</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.Point_inheritance.png" alt="Inheritance diagram of Point" 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.Point.html" title="wx.Point" alt="" coords="5,5,84,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.Point.__init__`                                                       Constructs a point.
:meth:`~wx.Point.Get`                                                            Return the x and y properties as a tuple.
:meth:`~wx.Point.GetIM`                                                          Returns an immutable representation of the ``wx.Point`` object, based on ``namedtuple``.
:meth:`~wx.Point.IsFullySpecified`                                               Returns ``True`` if neither of the point components is equal to DefaultCoord.
:meth:`~wx.Point.SetDefaults`                                                    Combine this object with another one replacing the uninitialized values.
:meth:`~wx.Point.__eq__`                                                         
:meth:`~wx.Point.__getitem__`                                                    
:meth:`~wx.Point.__len__`                                                        
:meth:`~wx.Point.__ne__`                                                         
:meth:`~wx.Point.__reduce__`                                                     
:meth:`~wx.Point.__repr__`                                                       
:meth:`~wx.Point.__setitem__`                                                    
:meth:`~wx.Point.__str__`                                                        
:meth:`~wx.Point.__iadd__`                                                       
:meth:`~wx.Point.__isub__`                                                       
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.Point.IM`                                                             See :meth:`~wx.Point.GetIM`
:attr:`~wx.Point.x`                                                              A public C++ attribute of type ``int``. x member.                  
:attr:`~wx.Point.y`                                                              A public C++ attribute of type ``int``. y member.                  
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.Point(object)

   **Possible constructors**::

       Point()
       
       Point(x, y)
       
       Point(pt)
       
   
   A Point is a useful data structure for graphics operations.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Constructs a point.                  
      
      Initializes the internal x and y coordinates to zero.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, x, y)`
      
      Initializes the point object with the given `x`  and `y`  coordinates.                  
      
      
      :param `x`: 
      :type `x`: int
      :param `y`: 
      :type `y`: int
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, pt)`
      
      Converts the given :ref:`wx.RealPoint`  (with floating point coordinates) to a :ref:`wx.Point`  instance.                  
      
      Notice that this truncates the floating point values of `pt`  components, if you want to round them instead you need to do it manually, e.g. ::
      
          rp = wx.RealPoint(10.3, 20.8)
          p = wx.Point(int(round(rp.x)), int(round(rp.y)))
      
                       
      
      
      :param `pt`: 
      :type `pt`: wx.RealPoint
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: Get(self)

      Return the x and y properties as a tuple. 

      :rtype: `tuple`







      :returns: 

         ( `x`, `y` ) 








   .. method:: GetIM(self)

      Returns an immutable representation of the ``wx.Point`` object, based on ``namedtuple``.
      
      This new object is hashable and can be used as a dictionary key,
      be added to sets, etc.  It can be converted back into a real ``wx.Point``
      with a simple statement like this: ``obj = wx.Point(imObj)``.



   .. method:: IsFullySpecified(self)

      Returns ``True`` if neither of the point components is equal to DefaultCoord.                  

      This method is typically used before calling :meth:`SetDefaults` . 

                

      :rtype: `bool`







      .. versionadded:: 2.9.2 
     








   .. method:: SetDefaults(self, pt)

      Combine this object with another one replacing the uninitialized values.                  

      It is typically used like this: 

      ::

                  if not pos.IsFullySpecified():

                      pos.SetDefaults(GetDefaultPosition())



                


      :param `pt`: 
      :type `pt`: wx.Point






      .. versionadded:: 2.9.2 
     







      .. seealso:: :meth:`IsFullySpecified`   








   .. method:: __eq__(self, other)



      :rtype: `bool`








   .. method:: __getitem__(self, idx)




   .. method:: __len__(self)




   .. method:: __ne__(self, other)



      :rtype: `bool`








   .. method:: __reduce__(self)




   .. method:: __repr__(self)




   .. method:: __setitem__(self, idx, val)




   .. method:: __str__(self)




   .. method:: __iadd__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

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

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






   .. method:: __isub__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

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

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






   .. attribute:: IM

      See :meth:`~wx.Point.GetIM`


   .. attribute:: x

      A public C++ attribute of type ``int``. x member.                  


   .. attribute:: y

      A public C++ attribute of type ``int``. y member.                  

