Define a rectangular area.
Many convenience handles and other properties are also defined - all
of which may be assigned to which will result in altering the position
and sometimes dimensions of the Rect.
The Rect area includes the bottom and left borders but not the top and
right borders.
|
|
__init__(self,
x,
y,
width,
height)
Create a Rect with the bottom-left corner at (x, y) and dimensions
(width, height).
|
|
|
set_x(self,
value)
|
|
|
set_y(self,
value)
|
|
|
set_width(self,
value)
|
|
|
set_height(self,
value)
|
|
|
set_position(self,
value)
|
|
|
set_size(self,
value)
|
|
|
contains(self,
x,
y)
Return boolean whether the point defined by x, y is inside the
rect area.
|
|
|
intersects(self,
other)
Return boolean whether the "other" rect (an object with
.x, .y, .width and .height attributes) overlaps this Rect in any
way.
|
|
|
get_top(self)
|
|
|
set_top(self,
y)
|
|
|
get_bottom(self)
|
|
|
set_bottom(self,
y)
|
|
|
get_left(self)
|
|
|
set_left(self,
x)
|
|
|
get_right(self)
|
|
|
set_right(self,
x)
|
|
|
get_center(self)
|
|
|
set_center(self,
center)
|
|
|
get_midtop(self)
|
|
|
set_midtop(self,
midtop)
|
|
|
get_midbottom(self)
|
|
|
set_midbottom(self,
midbottom)
|
|
|
get_midleft(self)
|
|
|
set_midleft(self,
midleft)
|
|
|
get_midright(self)
|
|
|
set_midright(self,
midright)
|
|
|
get_topleft(self)
|
|
|
set_topleft(self,
position)
|
|
|
get_topright(self)
|
|
|
set_topright(self,
position)
|
|
|
get_bottomright(self)
|
|
|
set_bottomright(self,
position)
|
|
|
get_bottomleft(self)
|
|
|
set_bottomleft(self,
position)
|
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__str__
|
|
|
x = property(lambda self: self._x, set_x)
|
|
|
y = property(lambda self: self._y, set_y)
|
|
|
width = property(lambda self: self._width, set_width)
|
|
|
height = property(lambda self: self._height, set_height)
|
|
|
position = property(lambda self:(self._x, self._y), set_position)
|
|
|
size = property(lambda self:(self._width, self._height), set_s...
|
|
|
top = property(get_top, set_top)
|
|
|
bottom = property(get_bottom, set_bottom)
|
|
|
left = property(get_left, set_left)
|
|
|
right = property(get_right, set_right)
|
|
|
center = property(get_center, set_center)
|
|
|
midtop = property(get_midtop, set_midtop)
|
|
|
midbottom = property(get_midbottom, set_midbottom)
|
|
|
midleft = property(get_midleft, set_midleft)
|
|
|
midright = property(get_midright, set_midright)
|
|
|
topleft = property(get_topleft, set_topleft)
|
|
|
topright = property(get_topright, set_topright)
|
|
|
bottomright = property(get_bottomright, set_bottomright)
|
|
|
bottomleft = property(get_bottomleft, set_bottomleft)
|
__init__
(Constructor)
__init__(self,
x,
y,
width,
height)
Create a Rect with the bottom-left corner at (x, y) and dimensions
(width, height).
- Overrides:
-
object.__init__