Package pyj2d :: Module rect :: Class Rect

Class Rect

java.awt.Rectangle --+
                     |
                    Rect

pyj2d.Rect

Instance Methods
 
__init__(self, *arg)
Return Rect that is subclassed from java.awt.Rectangle.
 
__str__(self)
 
__repr__(self)
 
setLocation(self, x, y)
 
setSize(self, width, height)
 
__setattr__(self, attr, val)
 
__getitem__(self, key)
 
__setitem__(self, key, val)
 
__iter__(self)
 
__len__(self)
 
__bool__(self)
 
__nonzero__(self)
 
__eq__(self, other)
 
__ne__(self, other)
 
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 the intersection of rect and 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.
 
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.
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)
Method Details

__init__(self, *arg)
(Constructor)

 

Return Rect that is subclassed from java.awt.Rectangle.

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 pyj2d.Rect in module's namespace.