.comment-link {margin-left:.6em;}

Sometimes I Wish That It Would Rain Here

Saturday, November 01, 2008

newest tinkering toy: NodeBox

I've been spending a little time over the past two days playing with NodeBox, a suite of graphical utilities for programmatic image creation. it's based largely on python and uses a bunch of the graphical innards available with Cocoa (thus, it's specific to Mac OS).

thus far, it's pretty awesome. it's pretty straight forward to understand and rather powerful with even simple commands. not only is there a super helpful tutorial, including primers on many programming concepts for non-programmers (variables, lists, loops, etc.), but it's very easy to quickly creating striking, perhaps even compelling images. in just a few minutes, I was able to throw together this image, based on random placement and coloring of all the tags I've used on this blog:


the sizes, positions, colors, and even which tags to use are all random (not all tags are used, and some are used more than once, e.g., "iTunes" shows up twice near the lower left corner). I realize that this does not adhere to more "traditional" approaches to tag clouds, where in position is based on alphabetical order and size is based on frequency of use, but for now I just wanted something fun. for example, the way that "iTunes" overlaps with the first three letters of "oxymoron" make the "-moron" part much more noticeable.

if you're at all interested in programmatic image generation (or just like playing with fun, designer-y toys), I highly recommend you check NodeBox out. I'm planning on using it to create some images based on the data behind metaViz, so keep an eye open for that in the next couple days (hopefully, before the election).

Labels: , , , , ,

Monday, May 05, 2008

"test" reserved word in python?

I just had a rather odd experience with python. I've got a module named "test" (specifically, a directory named "test" with an empty __init__.py file in it) with a couple other modules in it, including one called "test_sel_pref" (i.e., a source file "test/test_sel_pref.py"). I can do

import test

just fine, but the module doesn't seem to contain anything other than the usual (__class__, __doc__, __file__, etc.). if I try

from test import test_sel_pref

I get

ImportError: cannot import name test_sel_pref

after checking several things, I started wording if "test" wasn't some sort of reserved word in python. it's not on the list of python keywords or the list of python reserved words, and keyword.iskeyword('test') returns False. just in case, I tried renaming the directory to "testData." sure enough,

from testData import test_sel_pref

worked like a charm. I looked around, but couldn't find anything that talked about an existing test module that would block me from having a module called test. for now, renaming the directory did the trick, but I'd like to know what was going on here. any thoughts?

Labels: ,