[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] rect.collidedict() and rect.collidedictall() patch



Don't know where the doco got lost. The output below was from help(Rect)
on Ubuntu which as pygame 1.7

Tim Ansell

On Sun, 2007-08-26 at 10:00 +0200, DR0ID wrote:
> http://www.pygame.org/docs/ref/rect.html#Rect.collidedict
> 
> does not say so.
> 
> ~DR0ID
<snip>

In [1]: import pygame

In [2]: pygame.__version__
Out[2]: '1.7.1release'

In [3]: print pygame.Rect.collidedict.__doc__
Rect.collidedict(dict if rectstyle keys) -> key/value pair
find overlapping rectangle in a dictionary

Returns the key/value pair of the first rectangle key
in the dict that overlaps the base rectangle. Once an
overlap is found, this will stop checking the
remaining list. If no overlap is found, it will
return None.

Remember python dictionary keys must be immutable,
Rects are not immutable, so they cannot directly be,
dictionary keys. You can convert the Rect to a tuple
with the tuple() builtin command.