I am trying to get started with pysdl2 on a windows machine. So far, I got to copying and pasting the Hello World tutorial so that I can see if it really works! This is not true.
import sys
import sdl2.ext
RESOURCES = sdl2.ext.Resources(__file__, "resources")
sdl2.ext.init()
window = sdl2.ext.Window("Hello World!", size=(640, 580))
window.show()
factory = sdl2.ext.SpriteFactory(sdl2.ext.SOFTWARE)
sprite = factory.from_image(RESOURCES.get_path("testimage.png"))
spriterenderer = factory.create_sprite_render_system(window)
spriterenderer.render(sprite)
processor = sdl2.ext.TestEventProcessor()
processor.run(window)
sdl2.ext.quit()
When I run the program, it briefly displays a window, and then gives an error message:
Traceback (most recent call last):
File "test.py", line 15, in <module>
spriterenderer.render(sprite)
File "C:\Python27\lib\site-packages\sdl2\ext\sprite.py", line 643, in render
surface.SDL_BlitSurface(sprites.surface, None, self.surface, r)
WindowsError: exception: access violation reading 0x03F3B000
although the address is different every time.
This only happens on large images - if I resized the image to 245 x 245pixels or smaller, then it will be displayed without complaint. I use Pillow to improve format support and get the same problem with bmp, pngand jpg.
Edited to add:
. , 245x245 , , - spriterenderer render(sprite) - print sprite , , - , . print, . , 500x500 access violation. , .