1. pygame
  2. pygame
  3. pygame
  4. Issues


Issue #25 resolved

Rect should have a copy method

René Dudfield
created an issue

== Nick Welch, 2008-11-21 01:36:44 -0800

{{{ The unofficial way, which seems to be in some old documentation cached by google but not in any of the actual documentation anymore, is to do myrect.move(0, 0). This is non-obvious and mysteriously undocumented now. A Rect.copy() method is much clearer and should be trivial to implement. }}}

== Nick Welch, 2008-11-21 01:40:46 -0800

{{{ Also, Rect(myrect) to do a copy is inconvenient because then it requires an import of Rect in every source file that you want to copy rects in. A Rect.copy() would lift that requirement, and is in line with Python style, e.g. dict.copy(). }}}

== Nick Welch, 2008-11-21 01:48:55 -0800

{{{ Err... ok, looking through the docs, there is a copy function available as copy which copy.copy() will use. So why not just make it Rect.copy() as dict does? }}}

== Lenard Lindstrom, 2009-02-12 12:50:07 -0800

{{{ More relevant, it is consistent with Surface.copy. Added in revision 1924. }}}

Comments (1)

  1. Log in to comment