About

How To Use

How To Develop

edit SideBar

Recent Changes
Printable View
Page History
Edit Page

Shoebot can also be loaded as a module.

After including an import statement,

  import shoebot

a NodeBot object needs to be created, and all further drawing commands can be called on that instance. 'NodeBot' implements the Nodebox vocabulary; in the future, other languages may be added to Shoebot.

NodeBot should be called with the output file name as an argument. The first call after that one has to be size(), otherwise you'll hear Shoebot complaining.

  bot = shoebot.NodeBot(outputfile="output.svg")

  # set size to 150x150
  bot.size(150,150)

  # draw a rectangle
  bot.fill(1,0,0)
  bot.rect(10,10,100,100)

When you're finished with drawing, just call

  bot.finish()

and your output file should be created.

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

  bot.snapshot("snap.png")

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

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

  bot.run('examples/primitives.bot')
Page last modified on December 29, 2008, at 10:34 AM