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)
 
__setattr__(self, attr, val)
x.__setattr__('name', value) <==> x.name = value
 
__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, width, height)
 
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.

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

Class Variables
  size = property(_get_size, _set_size)
  center = property(_get_center, _set_center)
  centerx = property(_get_centerx, _set_centerx)
  centery = property(_get_centery, _set_centery)
  top = property(_get_top, _set_top)
  left = property(_get_left, _set_left)
  bottom = property(_get_bottom, _set_bottom)
  right = property(_get_right, _set_right)
  topleft = property(_get_topleft, _set_topleft)
  bottomleft = property(_get_bottomleft, _set_bottomleft)
  topright = property(_get_topright, _set_topright)
  bottomright = property(_get_bottomright, _set_bottomright)
  midtop = property(_get_midtop, _set_midtop)
  midleft = property(_get_midleft, _set_midleft)
  midbottom = property(_get_midbottom, _set_midbottom)
  midright = property(_get_midright, _set_midright)
  w = property(_get_w, _set_w)
  h = property(_get_h, _set_h)
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

Attribute access is functional in strict mode (-S), while in optimized mode (-O) direct access can be used with x/y/width/height whereas other attributes can be accessed with getattr/setattr functions or build with the --enable-descriptor-proto option.

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)

__setattr__(self, attr, val)

 
x.__setattr__('name', value) <==> x.name = value
Overrides: object.__setattr__
(inherited documentation)