Shoebox 0.2

Shoebox is a pure Python version/rewrite of Nodebox.
Shoebox is a pure Python version/rewrite of Nodebox, a Mac OS X application developed by Frederik Bleser and Tom de Smedt at St. Lucas University in Antwerp, Belgium, from the DrawBot application developed by Just van Rossum.

Shoebox uses the Cairo graphics engine for rendering, and instead of a full-fledged GUI it provides a simple command-line interface and the ability to be called from external Python scripts without effort.

Shoebox also borrows from the principles outlined in the Little Coder's Predicament, a manifesto by the author of Shoes, which is a similar and awesome project using the Ruby language instead of Python.

Shoebox can read scripts in the Nodebox language and output images in SVG, PostScript, PDF or PNG format.

Comparing to graphics coding alternatives like Nodebox and Processing, Shoebox ends up being lighter and more flexible, thanks to not depending on an interface engine for rendering, and thus making it potentially suitable for CPU-conscious uses like server applications. Unlike Processing and Nodebox though, Shoebox can only output still images for the time being.

Shoebox can be run stand-alone or as part of a Python program - see the Getting Started page for more details. There's a lot of stuff that is still subject to change and/or not working as it should - please regard it as being in a very early alpha phase -, but we're coding and typing hard to solve this!

It should run on most GNU/Linux systems.

This is free software, distributed under the GPLv3 license.

Requirements:

Cairo 1.4.2 or higher
Python 2.4 or higher
Mercurial

Installing Shoebox

For now, the only means of installing Shoebox is getting it from the source
repository. Shoebox uses Mercurial for version control. Mercurial is available
on most major GNU/Linux distributions.

Ubuntu/Debian: sudo apt-get install mercurial
Gentoo: emerge mercurial

Make a new directory for your Shoebox project(s), and then run the following command in your terminal:

hg clone http://hg.assembla.com/shoebox

You should now see a new shoebox/ directory inside your project dir.

Running Shoebox from the console

It's probably appropriate to place your scripts inside the shoebox dir for now. (this is a makeshift solution until we have a proper package for Shoebox)

Usage is rather straightforward:

python console.py script.py outputfile < width > < height >

* outputfile should have a valid extension (.svg, .ps, .pdf or .png), since
it will be autodetected by the script;
* 'width' and 'height' are optional values; if not specified, the resulting
image will be 400x400 pixels (bitmap output) or 400x400 points (vector
output).

Try running the blocks_neat.py example in the shoebox/examples dir.

Running Shoebox as a Python module

Shoebox can also be loaded as a module. For now, scripts taking advantage of this must be placed inside the shoebox dir.

After including an import statement,

import shoebox

a Box object needs to be created, and all further Nodebox commands can be called on that instance.

Box should be called with the output file name as an argument. Width and
height can also be specified - otherwise it defaults to a 400x400 canvas.

box = shoebox.Box("output.svg",100,100)
box.rect(10,10,100,100)


When you're finished with drawing, just call

box.finish()

and your output file should be created.

Also, when using bitmap files, you can save snapshots of the current state
of the Box instance like so:

box.snapshot("snap.png")

Note that this doesn't work if your Box object was created with a vector
format output.

You can even call external Shoebox/Nodebox scripts from your Python script:

box.run("script.py")

What's New in This Release:

This release has a GTK canvas interface (the first stab at a proper canvas, but it works decently).
Now you can access internal variables through a socket connection. size(), setup() and draw() now behave as they should.
The Box class has a run() method for executing external scripts from inside a Python program.

last updated on:
June 5th, 2008, 7:22 GMT
price:
FREE!
homepage:
shoebox.sollec.org
license type:
GPL v3 
developed by:
Ricardo Lafuente
category:
ROOT \ Multimedia \ Graphics
Shoebox
Download Button

In a hurry? Add it to your Download Basket!

user rating 16

3.8/5
 

0/5

Rate it!

Add your review!

SUBMIT