Package pyjsdl :: Module rect :: Class Rect

Class Rect

object --+
         |
        Rect

pyjsdl.Rect

Instance Methods
 
__init__(self, *args)
Return Rect object.
 
__str__(self)
str(x)
 
__repr__(self)
repr(x)
 
__getitem__(self, key)
 
__setitem__(self, key, val)
 
__iter__(self)
 
__len__(self)
 
__bool__(self)
 
__nonzero__(self)
 
__eq__(self, other)
 
__ne__(self, other)
 
setLocation(self, x, y)
 
setSize(self, w, h)
 
copy(self)
Returns Rect that is a copy of this rect.
 
move(self, *offset)
Return Rect of same dimension at position offset by x,y.
 
move_ip(self, *offset)
Moves this rect to position offset by x,y.
 
inflate(self, *offset)
Return Rect at same position but size offset by x,y.
 
inflate_ip(self, *offset)
Change size of this rect offset by x,y.
 
clip(self, rect)
Return Rect representing this rect clipped by rect.
 
intersection(self, rect)
Return Rect representing this rect clipped by rect.
 
contains(self, rect)
Check if rect is in this rect.
 
intersects(self, rect)
Check if rect intersects this rect.
 
union(self, rect)
Return Rect representing the union of rect and this rect.
 
union_ip(self, rect)
Change this rect to represent the union of rect and this rect.
 
unionall(self, rect_list)
Return Rect representing the union of rect list and this rect.
 
unionall_ip(self, rect_list)
Change this rect to represent the union of rect list and this rect.
 
clamp(self, rect)
Return Rect of same dimension as this rect moved within rect.
 
clamp_ip(self, rect)
Move this rect within rect.
 
set(self, *args)
Set rect x,y,width,height attributes to argument. Alternative arguments: * x,y,w,h * (x,y),(w,h) * (x,y,w,h) * Rect * Obj with rect attribute
 
collidepoint(self, *point)
Return True if point is in this rect.
 
colliderect(self, rect)
Return True if rect collides with this rect.
 
collidelist(self, rects)
Return index of rect in list that collide with this rect, otherwise returns -1.
 
collidelistall(self, rects)
Return list of indices of rects list that collide with this rect.
 
collidedict(self, rects)
Return (key,value) of first rect from rects dict that collide with this rect, otherwise returns None.
 
collidedictall(self, rects)
Return list of (key,value) from rects dict that collide with this rect.
 
x(self, val)
 
y(self, val)
 
width(self, val)
 
height(self, val)
 
center(self, val)
 
centerx(self, val)
 
centery(self, val)
 
top(self, val)
 
left(self, val)
 
bottom(self, val)
 
right(self, val)
 
topleft(self, val)
 
bottomleft(self, val)
 
topright(self, val)
 
bottomright(self, val)
 
midtop(self, val)
 
midleft(self, val)
 
midbottom(self, val)
 
midright(self, val)
 
size(self, val)
 
w(self, val)
 
h(self, val)

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, *args)
(Constructor)

 

Return Rect object.

Alternative arguments:

  • x, y, width, height
  • (x, y), (width, height)
  • (x, y, width, height)
  • Rect
  • Obj with rect attribute

Rect has the attributes:

x, y, width, height top, left, bottom, right topleft, bottomleft, topright, bottomright midtop, midleft, midbottom, midright center, centerx, centery size, w, h

Module initialization places pyjsdl.Rect in module's namespace.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

 
str(x)
Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)

x(self, val)

 
Decorators:
  • @x.setter

y(self, val)

 
Decorators:
  • @y.setter

width(self, val)

 
Decorators:
  • @width.setter

height(self, val)

 
Decorators:
  • @height.setter

center(self, val)

 
Decorators:
  • @center.setter

centerx(self, val)

 
Decorators:
  • @centerx.setter

centery(self, val)

 
Decorators:
  • @centery.setter

top(self, val)

 
Decorators:
  • @top.setter

left(self, val)

 
Decorators:
  • @left.setter

bottom(self, val)

 
Decorators:
  • @bottom.setter

right(self, val)

 
Decorators:
  • @right.setter

topleft(self, val)

 
Decorators:
  • @topleft.setter

bottomleft(self, val)

 
Decorators:
  • @bottomleft.setter

topright(self, val)

 
Decorators:
  • @topright.setter

bottomright(self, val)

 
Decorators:
  • @bottomright.setter

midtop(self, val)

 
Decorators:
  • @midtop.setter

midleft(self, val)

 
Decorators:
  • @midleft.setter

midbottom(self, val)

 
Decorators:
  • @midbottom.setter

midright(self, val)

 
Decorators:
  • @midright.setter

size(self, val)

 
Decorators:
  • @size.setter

w(self, val)

 
Decorators:
  • @w.setter

h(self, val)

 
Decorators:
  • @h.setter