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

[pygame] BUG: problem with surface clipping region

I'm having this problem with the Surface.set_clip() method that appears to be a bug:

    import pygame
    print pygame.__version__
    s = pygame.display.set_mode((800, 600))
    r = pygame.Rect(10, 10, 10, 10)
    print s.get_clip()
    r.move_ip(10, 0)
    print s.get_clip()
    print s.get_clip()

This yields the following output:

    <rect(10, 10, 10, 10)>
    <rect(10, 10, 10, 10)>
    <rect(25708, 0, 0, 600)>

After this, the clip region of the display surface is garbled and operations on the surface fail.  Running the script again yields a different garbled value.

I tried modifying the line with set_clip() with:


but this did not solve the problem.

Is this really a bug, or am I doing something wrong?  Also, my apologies if this has been discussed before.