.. include:: headings.inc .. _Point: ========================================================================================================================================== |phoenix_title| **Point** ========================================================================================================================================== A :ref:`Point` is a useful data structure for graphics operations. It contains integer `x` and `y` members. See :ref:`RealPoint` for a floating point version. Note that the width and height stored inside a :ref:`Point` object may be negative and that :ref:`Point` functions do not perform any check against negative values (this is used to e.g. store the special -1 value in ``DefaultPosition`` instance). .. seealso:: :ref:`RealPoint` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **Point** .. raw:: html

Inheritance diagram of Point

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~Point.__init__` Constructs a point. :meth:`~Point.Get` Return the x and y properties as a tuple. :meth:`~Point.IsFullySpecified` Returns ``True`` if neither of the point components is equal to DefaultCoord. :meth:`~Point.SetDefaults` Combine this object with another one replacing the uninitialized values. :meth:`~Point.__getitem__` :meth:`~Point.__len__` :meth:`~Point.__nonzero__` :meth:`~Point.__reduce__` :meth:`~Point.__repr__` :meth:`~Point.__setitem__` :meth:`~Point.__str__` :meth:`~Point.__iadd__` :meth:`~Point.__isub__` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: Point(object) A Point is a useful data structure for graphics operations. **Possible constructors**:: Point() Point(x, y) Point(pt) .. method:: __init__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__init__** `(self)` Constructs a point. Initializes the internal x and y coordinates to zero. **~~~** **__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 **~~~** **__init__** `(self, pt)` Converts the given :ref:`RealPoint` (with floating point coordinates) to a :ref:`Point` instance. :param `pt`: :type `pt`: RealPoint **~~~** .. method:: Get(self) Return the x and y properties as a tuple. :rtype: `tuple` :returns: ( `x`, `y` ) .. 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`: Point .. versionadded:: 2.9.2 .. seealso:: :meth:`IsFullySpecified` .. method:: __getitem__(self, idx) .. method:: __len__(self) .. method:: __nonzero__(self) .. method:: __reduce__(self) .. method:: __repr__(self) .. method:: __setitem__(self, idx, val) .. method:: __str__(self) .. method:: __iadd__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__iadd__** `(self)` :param `sz`: :type `sz`: Size **~~~** **__iadd__** `(self)` :param `pt`: :type `pt`: Point **~~~** .. method:: __isub__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__isub__** `(self)` :param `sz`: :type `sz`: Size **~~~** **__isub__** `(self)` :param `pt`: :type `pt`: Point **~~~**