[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] pygame and wxpython - problem with png's
Hi Pygame users,
I'm using pygame in combination with wxpython. My application fails with the
following error when I try to load a png file:
libpng error: invalid stored block lengths
Pygame Parachute Traceback:
Segmentation fault
The png file is a valid file - and it works fine when I import it in pygame
standalone code.
Has anyone got any ideas what is wrong with my code or do you have any
suggestions what I should do to investigate it further. Any help would be
greatly appreciated.
My configuration is:
Mandrake Linux 10
Pygame 1.6
wxPython 2.4.2.4
Here is the code:
-------------------
from wxPython.wx import *
from wxGameCanvas import wxGameCanvas
class MainWindow(wxFrame):
""" We simply derive a new class of Frame. """
def __init__(self,parent,id,title):
wxFrame.__init__(self,parent,wxID_ANY, title, size = ( 802,493),
style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
# Create pygame content
self.panel = wxPanel(parent = self, id = -1, style = wxTAB_TRAVERSAL |
wxCLIP_CHILDREN, pos = wxPoint(0, 0))
self.pg = PygameCanvas(self.panel,-1)
self.Show(true)
class PygameCanvas(wxGameCanvas):
""" Handles pygame embedded into wxPython """
def run(self):
import pygame
try:
surface = pygame.image.load('test.png')
except pygame.error:
raise SystemExit, 'Could not load image "%s" %s'%(name, pygame.get_error())
def main():
app = wxPySimpleApp()
frame = MainWindow(None, -1, "")
app.MainLoop()
-------------------------
wxGameCanvas can be found here and should be placed in the same directory as
the above file:
http://wiki.wxpython.org/index.cgi/IntegratingPyGame
Kind regards,
Jesper