473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

protect resources (images) within a pygame-program

A pygame/python game resource question
######################################
I wander whether there is any possibility to compile a bunch of
resources for a program, like images and soundfiles into a package
like, let´s say "game.dat", so they do´t fly around in the programs
folder und can be edited by everyone.
Hope somebody can help me.
Jul 18 '05 #1
3 1666
Using ResourcePackage may help you.

Basically this provides a sub-package of your project in which you dump
your resources. You then use mypackage.resources.filename_ext.data as
the source for your files. This allows your data-files to survive being
py2exe'd or zipped just as if they were regular Python modules (since
they are python modules). However, if you users want to edit them, they
need merely download ResourcePackage (and get a version of your package
that is stored in the filesystem (i.e. unzip your package)) and edit the
source files. If you want to just pack one copy in your game, then you
can pack the .py files and let the users extract them using
ResourcePackage's included scripts.

That is:

unzip yourproject
extract.py -f yourproject.resourcePackageName

To get the files in editable format.

If you mean, instead, that you want to have the files stored in some
commonly accessible location, rather than in the program files
hierarchy. You can store the files in the user's Application Data
folder (well, in a sub-directory of that).

http://resourcepackage.sourceforge.net/

HTH,
Mike

benjamin wrote:
A pygame/python game resource question
######################################
I wander whether there is any possibility to compile a bunch of
resources for a program, like images and soundfiles into a package
like, let´s say "game.dat", so they do´t fly around in the programs
folder und can be edited by everyone.
Hope somebody can help me.

________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com

Jul 18 '05 #2
On Thu, 21 Oct 2004 11:43:23 -0700, benjamin wrote:
I wander whether there is any possibility to compile a bunch of
resources for a program, like images and soundfiles into a package
like, let´s say "game.dat", so they do´t fly around in the programs
folder
Valid; I'd suggest zipping them up and using the "zipfile" module,
standard w/ Python 2.3.
und can be edited by everyone.


It is unclear to me whether you *want* them editable, or if you don't.
(Does the "not" in "do't" [sic] apply to just the first clause, or both?)

If you *want* them editable, zip files are great because they are
reasonably standard, and you can just unzip them, make the changes, and
zip them up. For extra bonus points, have your program look for the
unzipped resources *first*, then look in the zip file. That way, you can
just unzip and make the changes, zipping only for final distribution.

If you *don't* want them editable, that's impossible. All local resources
can always be edited. Even the "big guys" haven't solved that problem.

Jul 18 '05 #3
benjamin wrote:
A pygame/python game resource question
######################################
I wander whether there is any possibility to compile a bunch of
resources for a program, like images and soundfiles into a package
like, let´s say "game.dat", so they do´t fly around in the programs
folder und can be edited by everyone.
Hope somebody can help me.


The easiest approach would probably be to load them into a whooping big
dictionar and save that as a pickle.

--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim Knauf | last post by:
Hi everyone, I'm glad to have found this list. I've written a small script for my own use which, amongst other things, captures mouse click information from a window containing an image. I used...
0
by: Philipp Seidel | last post by:
Hi there! I did not know, where this topic fits in, so I put it here. I have a minor problem with embedded resources, which puzzles me quite a lot. I'd be glad if anyone can help me on this: ...
11
by: LarryM | last post by:
Hi, NB, not to stop capturing the single displayed Image, but to stop downloading the entire image directory. (In my Website you will do a search, and get some thumbnails, and these can be...
1
by: kjm | last post by:
Hi everyone, I have recently acquired a Logitech Rumble pad to use as an input device. I have been having trouble getting the event que to respond that a button or hat arrow has been pressed. ...
1
by: spencermiles | last post by:
Hello, I'm working on a large solution, comprised on numerous Projects, and I would like to have one central projects that contains a set of global RESX Resources. It doesn't make sense to have...
5
by: WT | last post by:
Hi, Documpentation for VS 2005 is not clear about how to put a gif image in resources and how to get it from an <asp:image .../> or <img /> web control. It seems that IE send some .axd process...
11
by: dynamo | last post by:
Hi guys i have come again with more problems.This time it has to do with pygame.The following code does not give any error messages but it does not do what it is supposed to do either.the code is a...
7
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. I have an ASP.NET 2.0 web application which contains an Images directory with all website images. How can I prevent other websites from creating img tags with the source as my images? I want...
11
by: globalrev | last post by:
http://www.pygame.org/docs/ref/mixer.html import pygame #pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=3072) //it complained abiout words= so i guess its only the nbrs...
2
tharden3
by: tharden3 | last post by:
Ok, I've been going through these tutorials for both PyGame and wxPython, but I've hit a big speed bump. In each tutorial, I've gotten to the point where I need to "import" or "load" images for...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.