wx.Rect2D¶Rect2DDouble is an axis-aligned rectangle; each side of the rect is parallel to the X or Y axis.
The rectangle is either defined by the top left and bottom right corner, or by the top left corner and size.
A point is contained within the rectangle if left <= m_x < right and top <= m_y < bottom; thus, it is a half open interval.
Note
Rect2DDouble has subtle differences from wx.Rect in how its edge and corner functions work. With Rect2DDouble , there are two counterparts:
SetXXX functions, which keep the other corners at their position whenever sensible
MoveXXX functions, which keep the size of the rectangle and move the other corners appropriately
Class Hierarchy¶
Inheritance diagram for class Rect2D:
Methods Summary¶Default constructor. |
|
Resizes the rectangle to fit within the dimensions of another rectangle. |
|
Returns |
|
Returns the intersecting rectangle of this rectangle with another one. |
|
Returns the union of this rectangle with another one. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Get() . (x, y, width, height) |
|
Returns the bottom point of the rectangle. |
|
Returns the centre point of the rectangle. |
|
Returns the height. |
|
Returns an immutable representation of the |
|
Returns the left point of the rectangle (the same as |
|
Returns the position of the bottom left corner. |
|
Returns the position of the top left corner of the rectangle, same as |
|
Returns the relative location of a point to the rectangle (e.g., inside or to the left of it). |
|
Returns the position. |
|
Returns the right point of the rectangle. |
|
Returns the position of the bottom right corner. |
|
Returns the position of the top right corner. |
|
Returns the size. |
|
Returns the top point of the rectangle (the same as |
|
Returns the width. |
|
Returns the left position of the rectangle. |
|
Returns the top position of the rect. |
|
Returns |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Offsets the rectangle by |
|
Constrains the rectangle to the intersection of another rectangle. |
|
Returns |
|
Returns |
|
Set the bottom edge of the rectangle, preserving the height. |
|
An alias for |
|
Set the bottom-left point of the rectangle, while preserving the width and height of the rectangle. |
|
Sets the left position, which may adjust the width of the rectangle. |
|
Set the top-left point of the rectangle, while preserving the width and height of the rectangle. |
|
Set the bottom-right point of the rectangle, while preserving the width and height of the rectangle. |
|
Set the right side of the rectangle, preserving the width. |
|
Set the top-right point of the rectangle, while preserving the width and height of the rectangle. |
|
Set the top edge of the rectangle, preserving the height. |
|
Moves the rectangle by the specified offset. |
|
Set the bottom edge of the rectangle. |
|
Recenters (i.e., moves) the rectangle to the given point. |
|
Sets the height. |
|
Set the left side of the rectangle. |
|
Set the bottom-left point of the rectangle. |
|
Set the top-left point of the rectangle. |
|
Set the right side of the rectangle. |
|
Set the bottom-right point of the rectangle. |
|
Set the top-right point of the rectangle. |
|
Set the top edge of the rectangle. |
|
Sets the width. |
|
Returns the rectangle as a wx.Rect. |
|
Expands the rectangle to the union with another rectangle. |
|
Inequality operator. |
|
Equality operator. |
Properties Summary¶See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
A public C++ attribute of type Double . |
|
A public C++ attribute of type Double . |
|
A public C++ attribute of type Double . |
|
A public C++ attribute of type Double . |
Class API¶Possible constructors:
Rect2DDouble() -> None
Rect2DDouble(x, y, width, height) -> None
Rect2DDouble(rect) -> None
Rect2DDouble is an axis-aligned rectangle; each side of the rect is parallel to the X or Y axis.
__init__ (self)
Default constructor.
Initializes to zero the internal m_x, m_y, m_width and m_height members.
None
__init__ (self, x, y, width, height)
Creates a Rect2DDouble object from x, y, width and height values.
x (wx.Double)
y (wx.Double)
width (wx.Double)
height (wx.Double)
None
__init__ (self, rect)
Constructs a Rect2DDouble from a wx.Rect.
rect (wx.Rect)
None
Added in version 4.3/wxWidgets-3.3.0.
Resizes the rectangle to fit within the dimensions of another rectangle.
rect (Rect2DDouble)
None
Contains (self, pt)
Returns True if the given point is inside the rectangle (or on its boundary) and False otherwise.
pt (Point2DDouble)
bool
Contains (self, rect)
Returns True if the given rectangle is completely inside this rectangle (or touches its boundary) and False otherwise.
rect (Rect2DDouble)
bool
Returns the intersecting rectangle of this rectangle with another one.
otherRect (Rect2DDouble)
Rect2DDouble
Returns the union of this rectangle with another one.
otherRect (Rect2DDouble)
Rect2DDouble
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Deflate (self, d)
d (wx.Size)
Rect2DDouble
Deflate (self, d)
d (wx.Double)
Rect2DDouble
Deflate (self, dx, dy)
dx (wx.Double)
dy (wx.Double)
Rect2DDouble
Get() . (x, y, width, height)
Return the rectangle’s properties as a tuple.
Any
Returns the bottom point of the rectangle.
float
Returns the centre point of the rectangle.
Point2DDouble
Returns the height.
float
Added in version 4.3/wxWidgets-3.3.0.
Returns an immutable representation of the wx.Rect2D 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.Rect2D
with a simple statement like this: obj = wx.Rect2D(imObj).
Returns the position of the bottom left corner.
Point2DDouble
Returns the position of the top left corner of the rectangle, same as GetPosition .
Point2DDouble
Returns the relative location of a point to the rectangle (e.g., inside or to the left of it).
pt (Point2DDouble)
Returns the position.
Point2DDouble
Returns the right point of the rectangle.
float
Returns the position of the bottom right corner.
Point2DDouble
Returns the position of the top right corner.
Point2DDouble
Returns the width.
float
Added in version 4.3/wxWidgets-3.3.0.
Returns the left position of the rectangle.
float
Added in version 4.3/wxWidgets-3.3.0.
Returns the top position of the rect.
float
Added in version 4.3/wxWidgets-3.3.0.
Returns True if another rectangle has the same width and height.
rect (Rect2DDouble)
bool
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Inflate (self, d)
d (wx.Size)
Rect2DDouble
Inflate (self, d)
d (wx.Double)
Rect2DDouble
Inflate (self, dx, dy)
dx (wx.Double)
dy (wx.Double)
Rect2DDouble
Inset (self, x, y)
Offsets the rectangle by x and y , but maintains the bottom right corner.
x (wx.Double)
y (wx.Double)
None
Note
This will affect the width and height of the rectangle.
Inset (self, left, top, right, bottom)
left (wx.Double)
top (wx.Double)
right (wx.Double)
bottom (wx.Double)
None
widthfactor (wx.int)
heightfactor (wx.int)
Point2DDouble
Intersect (self, otherRect)
Constrains the rectangle to the intersection of another rectangle.
otherRect (Rect2DDouble)
None
Intersect (src1, src2, dest)
Returns the intersecting rectangle of two rectangles.
src1 (Rect2DDouble)
src2 (Rect2DDouble)
dest (Rect2DDouble)
None
Returns True if this rectangle has a non-empty intersection with the rectangle rect and False otherwise.
rect (Rect2DDouble)
bool
Returns True if this rectangle has a width or height less than or equal to 0 and False otherwise.
bool
Set the bottom edge of the rectangle, preserving the height.
n (wx.Double)
None
An alias for MoveCentreTo .
pt (Point2DDouble)
None
Set the bottom-left point of the rectangle, while preserving the width and height of the rectangle.
pt (Point2DDouble)
None
Sets the left position, which may adjust the width of the rectangle.
n (wx.Double)
None
Set the top-left point of the rectangle, while preserving the width and height of the rectangle.
pt (Point2DDouble)
None
Set the bottom-right point of the rectangle, while preserving the width and height of the rectangle.
pt (Point2DDouble)
None
Set the right side of the rectangle, preserving the width.
n (wx.Double)
None
Set the top-right point of the rectangle, while preserving the width and height of the rectangle.
pt (Point2DDouble)
None
Set the top edge of the rectangle, preserving the height.
n (wx.Double)
None
Offset (self, pt)
Moves the rectangle by the specified offset.
If X of pt is positive, the rectangle is moved to the right, if Y of pt is positive, it is moved to the bottom, otherwise it is moved to the left or top respectively.
pt (Point2DDouble)
None
Offset (self, dx, dy)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
dx (wx.Double)
dy (wx.Double)
None
Added in version 4.3/wxWidgets-3.3.0.
Scale (self, f)
f (wx.Double)
None
Scale (self, num, denum)
num (wx.int)
denum (wx.int)
None
Set the bottom edge of the rectangle.
n (wx.Double)
None
Note
This will preserve the top position and alter the height of the rectangle. Use MoveBottomTo to only move the bottom.
Recenters (i.e., moves) the rectangle to the given point.
pt (Point2DDouble)
None
Sets the height.
h (wx.Double)
None
Added in version 4.3/wxWidgets-3.3.0.
Set the left side of the rectangle.
n (wx.Double)
None
Note
This will preserve the width of the rectangle. Use MoveLeftTo to change the left position of the rectangle, adjusting its width accordingly.
Set the bottom-left point of the rectangle.
pt (Point2DDouble)
None
Note
This will alter the width and height of the rectangle. Use MoveLeftBottomTo to only move the left bottom corner.
Set the top-left point of the rectangle.
pt (Point2DDouble)
None
Note
This will alter the height of the rectangle. Use MoveLeftTopTo to only move the top.
Set the right side of the rectangle.
n (wx.Double)
None
Note
This will preserve the left position and alter the width of the rectangle. Use MoveRightTo to only move the bottom.
Set the bottom-right point of the rectangle.
pt (Point2DDouble)
None
Note
This will alter the width and height of the rectangle. Use MoveRightBottomTo to only move the right bottom corner.
Set the top-right point of the rectangle.
pt (Point2DDouble)
None
Note
This will alter the width and height of the rectangle. Use MoveRightTopTo to only move the right top corner.
Set the top edge of the rectangle.
n (wx.Double)
None
Note
This will alter the height of the rectangle. Use MoveTopTo to only move the top.
Sets the width.
w (wx.Double)
None
Added in version 4.3/wxWidgets-3.3.0.
Returns the rectangle as a wx.Rect.
Added in version 4.3/wxWidgets-3.3.0.
Union (self, otherRect)
Expands the rectangle to the union with another rectangle.
otherRect (Rect2DDouble)
None
Union (self, pt)
Expands the rectangle to include the point at pt .
pt (Point2DDouble)
None
Union (src1, src2, dest)
Returns the union rectangle of two rectangles.
src1 (Rect2DDouble)
src2 (Rect2DDouble)
dest (Rect2DDouble)
None
Inequality operator.
rect (Rect2DDouble)
bool
Equality operator.
rect (Rect2DDouble)
bool
See GetLeftBottom and SetLeftBottom
See GetLeftTop and SetLeftTop
See GetPosition
See GetRightBottom and SetRightBottom
See GetRightTop and SetRightTop
A public C++ attribute of type Double .
A public C++ attribute of type Double .
A public C++ attribute of type Double .
A public C++ attribute of type Double .