kurt is a Python library for reading/writing Scratch project (.sb) and sprite files.
So far, it can read/write sprites and their properties, including scripts, blocks, variables, and lists. It can read costumes and export them to separate image files. It can also export scripts to scratchblocks format for pasting into the Scratch forums/wiki.
You could use it for:
- converting to another format (like the scratchblocks converter does)
- generating Scratch projects using Python code
- analysing the scripts in a project
- (someday, perhaps...) making a "Scratch IDE" text-based editor for Scratch scripts...
(It can't write images as costumes or read/write sounds yet, but they're on the to-do list — see below)
WARNING: Make sure you take a backup of your Scratch projects before saving anything with kurt! kurt is by no means fully tested. I can't accept respons ibility for corrupting your files.
If you're interested in technical details of how the format works: the code should be pretty self-documenting; but check out the documentation on the Scratch wiki, which might be more readable...
Download the latest version of Kurt and extract the kurt folder somewhere in your sys.path — or in the same directory as your code, if you prefer.
You'll need the latest version of the awesome Construct library — used for defining the format. It currently appears to be available here. (I'm using Construct version 2.04).
For saving images, you'll need the PyPNG module. Kurt should work without it, if you don't want to save images — but it's strongly recommended.
Tested with Python 2.6. Works with Scratch 1.4; not tested with earlier versions, but possibly works.
Scratch is created by the Lifelong Kindergarten Group at the MIT Media Lab.
What's New in This Release: [ read full changelog ]
· Can now parse images!
· Well, most images. If not, try reloading the project with Scratch and saving it again â" this sometimes helps.
· Unfortunately, Kurt doesn't compress the images when saving them back to the file again (yet), so it may massively increase your file size :P Again, you can just open it in Scratch and save it again, and the file size will be back to normal.
· Split Sprite.medi a into separate costumes/sounds lists.