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

Re: [pygame] cross-platform prefs storage?



Hey,
This is probobly a good place to ask such a question, as most of the projects people do in pygame use a config file of sorts for exactly what you mentioned.

Python being the "batteries included" language it is has such a utility available, it is called: ConfigParser. You should be able to find plenty of info on it with google.
(For my needs I actually subclassed ConfigParser.ConfigParser to extend it slightly, but anyway...)

- Jacob

This is not strictly pygame-related, but since most pygame projects support multiple platforms to a certain degree, some of you have probably encountered this issue before...

What I'm thinking about is storage of small amounts of user-specific data, for example preferences for video settings and control settings, or storage of a high-score table. Under Unix you'd usually put everything in a ~/.myprogram file/dir, on Mac OS X you can either do that or use NSUserDefaults. I guess I have two questions:

- Where do Windows programs ususally store these things? The registry (blah)? A .ini file in the launch directory (double blah)?

- Has anyone written/seen a python wrapper for this type of prefs storage that will take account of the platform and do the right thing?

This seems like such a common need, it seems pointless to reinvent the wheel.

//jack