wx.Point¶
A wx.Point is a useful data structure for graphics operations.
It contains integer x and y members. See wx.RealPoint for a floating point version.
Note that the width and height stored inside a wx.Point object may be negative and that 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).
See also
Class Hierarchy¶
Methods Summary¶
Constructs a point. |
|
Return the x and y properties as a tuple. |
|
Returns an immutable representation of the |
|
Returns |
|
Creates a wx.Point by rounding the coordinates of the given wx.RealPoint. |
|
Combine this object with another one replacing the uninitialized values. |
|
Creates a wx.Point by truncating the coordinates of the given wx.RealPoint. |
|
Properties Summary¶
See |
|
A public C++ attribute of type |
|
A public C++ attribute of type |
Class API¶
- class wx.Point(object)¶
Possible constructors:
Point() -> None Point(x, y) -> None Point(pt) -> None
A Point is a useful data structure for graphics operations.
Methods¶
- __init__(self, *args, **kw)¶
-
__init__ (self)
Constructs a point.
Initializes the internal x and y coordinates to zero.
- Return type:
None
__init__ (self, x, y)
Initializes the point object with the given x and y coordinates.
- Parameters:
x (int)
y (int)
- Return type:
None
__init__ (self, pt)
Converts the given wx.RealPoint (with floating point coordinates) to a wx.Point instance.
Notice that since v3.1.2 the behaviour of this constructor has changed to round the floating point values of pt components, if you want to truncate them instead, please use
wx.Point.Truncate.- Parameters:
pt (wx.RealPoint)
- Return type:
None
- Get(self)¶
Return the x and y properties as a tuple.
- Return type:
Any
- GetIM(self)¶
Returns an immutable representation of the
wx.Pointobject, based onnamedtuple.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.Pointwith a simple statement like this:obj = wx.Point(imObj).
- IsFullySpecified(self)¶
Returns
Trueif neither of the point components is equal to DefaultCoord.This method is typically used before calling
SetDefaults.- Return type:
bool
Added in version 2.9.2.
- static Round(pt)¶
Creates a wx.Point by rounding the coordinates of the given wx.RealPoint.
This is equivalent to using the constructor taking wx.RealPoint but is more explicit about the fact that rounding is performed.
- Parameters:
pt (wx.RealPoint)
- Return type:
Added in version 4.3/wxWidgets-3.3.2.
- 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())
- Parameters:
pt (wx.Point)
- Return type:
None
Added in version 2.9.2.
See also
- static Truncate(pt)¶
Creates a wx.Point by truncating the coordinates of the given wx.RealPoint.
This is similar to
Roundbut instead of rounding the coordinates, they are simply truncated to integers.- Parameters:
pt (wx.RealPoint)
- Return type:
Added in version 4.3/wxWidgets-3.3.2.
- __eq__(self, other)¶
- Return type:
bool
- __getitem__(self, idx)¶
- __len__(self)¶
- __ne__(self, other)¶
- Return type:
bool
- __reduce__(self)¶
- __repr__(self)¶
- __setitem__(self, idx, val)¶
- __str__(self)¶
- __iadd__(self, *args, **kw)¶
-
__iadd__ (self, sz)
__iadd__ (self, pt)
- __isub__(self, *args, **kw)¶
-
__isub__ (self, sz)
__isub__ (self, pt)
Properties¶
- x¶
A public C++ attribute of type
int. x member.
- y¶
A public C++ attribute of type
int. y member.
