.. 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 `wx.DefaultPosition` instance).
.. seealso:: :ref:`wx.RealPoint`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
Point:
|
|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() -> None
Point(x : int, y : int) -> None
Point(pt : RealPoint) -> None
A Point is a useful data structure for graphics operations.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self)`
Constructs a point.
Initializes the internal x and y coordinates to zero.
:rtype: `None`
:html:`
`
**__init__** `(self, x : int, y : int)`
Initializes the point object with the given `x` and `y` coordinates.
:param `x`:
:type `x`: int
:param `y`:
:type `y`: int
:rtype: `None`
:html:`
`
**__init__** `(self, pt : RealPoint)`
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
:rtype: `None`
:html:`
`
.. 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 : Point)
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
:rtype: `None`
.. versionadded:: 2.9.2
.. seealso:: :meth:`IsFullySpecified`
.. method:: __eq__(self, other: Point)
:rtype: `bool`
.. method:: __getitem__(self, idx)
.. method:: __len__(self)
.. method:: __ne__(self, other: Point)
: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:`
`
**__iadd__** `(self)`
:param `sz`:
:type `sz`: wx.Size
:html:`
`
**__iadd__** `(self)`
:param `pt`:
:type `pt`: wx.Point
:html:`
`
.. method:: __isub__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__isub__** `(self)`
:param `sz`:
:type `sz`: wx.Size
:html:`
`
**__isub__** `(self)`
:param `pt`:
:type `pt`: wx.Point
:html:`
`
.. 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.