PDA

View Full Version : Restarting Python script



Nevon
June 14th, 2009, 08:30 PM
I'm part of a group developing a FOSS, cross-platform, point-and-click adventure game in Python, using SDL through Pygame.

I'm currently looking to hack together a sort of pause menu that allows you to quit or start a new game. Quitting isn't very hard, but starting a new game has proved harder than I first thought it would be. All you would need to do is restart the program. But so far I haven't really found a very good way to do this. Any ideas?

If you're interested in the project, you can check out my blog (http://www.blastfromthepast.se/blabbermouth/), or have a look at the source code (http://github.com/kallepersson/subterranean/tree/) itself.

Tony Flury
June 16th, 2009, 03:57 PM
If you have built your application as a set of classes - then restarting the Application is simply a case of deleting the Application object and recreating it.

if you have your engine and your gui as seperate classes then this should restart the game = without restarting the gui.

Nevon
June 17th, 2009, 09:16 AM
If you have built your application as a set of classes - then restarting the Application is simply a case of deleting the Application object and recreating it.

if you have your engine and your gui as seperate classes then this should restart the game = without restarting the gui.

Wow! Why didn't I think of that? :oops: