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

[pygame] wxpython + pygame again



hi

I am giving a go once again to combining Pygame and wxPython.
This time I am being more successful. However I would like to hear some feedbacks about the way I am doing it.

My main problem is that because pygame cannot be imorted on the headers but "on the fly" if I need to create classes that extend some pygame library such as pygame.sprite.Sprite I get an error coz pygame hasnt been imported yet. In the example at the wxpython wiki it only uses standard classes from python and doesnt extend any of them so you dont get this error but if you want to do anything serious you need to create your own classes of course.

To avoid this problem I decided to locate my pygame classes a separated library and import it "on the fly" just after importing pygame.

This way almost all the code related to pygame lives inside the run() function of the SDLThread class.

So far this worked fine. However i would like to know if this is a "legal" way to do it or if this is a really bad idea. If so it would be good to hear some other possible solutions to this.

thanks