CodeNewbie Community

Discussion on: pygame.transform.chop

Collapse
eineki profile image
Eineki

As you already discovered, the chop works at the opposite of what you need. You select a cross to remove from an image and the remaining areas are glued together in a new image.

I drew to pictures to better explain what I mean:

  • you select the red area,
  • the red and yellow areas are removed
  • the remaining green parts are drawn toward the center and glued together. center removed

If you select a corner, you will observe exactly the behaviour you described (area color meanings are the same of the picture above):
sides removed

To select a rectangular surface of an image, mainly to get sprites from a spritesheet, you need to use the pygame.Surface.subsurface method. It define a child image of your main one ready to be blitted on a new surface or used as is.

Warning Changes to the main surface or to the subsurface will be reflected on the other one.

Collapse
tankerguy1917 profile image
tankerguy1917 Author

thanks for the explanation!