Bases: object
Type to store and manipulate rectangular coordinates.
This class provides the description of a rectangle and means to access and modify its properties in an easy way.
Usage example:
>>> r1 = Rect(10, 20, 30, 40)
>>> r2 = Rect((0, 0), (100, 100))
>>> r1
Rect(x=10, y=20, w=30, h=40)
>>> r2
Rect(x=0, y=0, w=100, h=100)
>>> r1.contains(r2)
False
>>> r2.contains(r1)
True
>>> r1 in r2 # same as r2.contains(r1)
True
>>> r1.intercepts(r2)
True
Attention
This is not a graphical object! Do not confuse with efl.evas.Rectangle.
Type: | (int w, int h) |
---|
Type: | int |
---|
Type: | (int x, int y) |
---|
Type: | (int x, int y) |
---|
Type: | (int x, int y) |
---|
Type: | int |
---|
Type: | int |
---|
Returns a new Rect that represents current moved inside given parameter.
If given rectangle is smaller, it’ll be centered.
Parameters: | obj – |
---|---|
Return type: | Rect |
Returns a new Rect that represents current cropped inside parameter.
Parameters: | obj – |
---|---|
Return type: | Rect |
Checks if this rectangle contains given rectangle.
Parameters: | obj – |
---|---|
Return type: | bool |
Checks if this rectangle contains the given point.
Parameters: |
|
---|---|
Return type: | bool |
cx: ‘int’
cy: ‘int’
Type: | int |
---|
Type: | int |
---|
Returns a new Rect that represents current inflated by given amount.
Parameters: |
|
---|---|
Return type: | Rect |
Deprecated since version 1.14: Use intersects() instead
Checks if this rectangle and the given rectangle intersect.
Parameters: | obj – |
---|---|
Return type: | bool |
Type: | int |
---|
Returns a new Rect that represents current moved by given offsets.
Parameters: |
|
---|---|
Return type: | Rect |
Normalize coordinates so both width and height are positive.
Type: | (int x, int y) |
---|
Type: | int |
---|
Type: | (int w, int h) |
---|
Type: | int |
---|
Type: | (int x, int y) |
---|
Type: | (int x, int y) |
---|
Returns a new Rect that covers both rectangles.
Parameters: | obj – |
---|---|
Return type: | Rect |
Type: | int |
---|
Type: | int |
---|
Type: | int |
---|
x0: ‘int’
x1: ‘int’
Type: | int |
---|
y0: ‘int’
y1: ‘int’