Skip to content

Instantly share code, notes, and snippets.

@tian2992
Created October 28, 2011 16:35
Show Gist options
  • Save tian2992/1322704 to your computer and use it in GitHub Desktop.
Save tian2992/1322704 to your computer and use it in GitHub Desktop.
Drawing With Shoebot as a Module
import shoebot
from shoebot.core import CairoCanvas, CairoImageSink, NodeBot
outputfile = 'output.svg'
iterations = 1
sink = CairoImageSink(outputfile, "svg", multifile = false)
canvas = CairoCanvas(sink, enable_cairo_queue=True)
bot = shoebot.core.NodeBot(canvas)
bot.size(150,150)
bot.fill(1,0,0)
bot.rect(10,10,100,100)
bot._canvas.flush(frame=0)
@stuaxo
Copy link

stuaxo commented Jan 16, 2013

Hi,
I've done an update and it's possible to do this with less knowledge of the internals again now:

import shoebot

bot = shoebot.init_bot(outputfile='helloworld.svg')
bot.size(150,150)
bot.fill(1,0,0)
bot.rect(10,10,100,100)
bot.finish()

Not nessacarily the final API, but fairly quick to get going with..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment