github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

bmander / prender

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 6
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A module for to render using the Processing renderer from Python — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

context manager throws errors upwards after finishing up 
Brandon Martin-Anderson (author)
Wed Apr 01 15:32:16 -0700 2009
commit  98f1e273fc46b44c85b082ec065cc08411dd7775
tree    3ed3e51a5994d19210c39a684d791f34dc1a92bf
parent  85d3a9666378bce5061f66e9cb5a2de9d3ef39c7
prender /
name age
history
message
file README Loading commit data...
file makefile
directory prender/
directory renderer/
file setup.py
README
PRender is a way to use Processing from inside Python. Like this:

Draw an X and save it as a "x.png":

  from prender import processing
  pr = processing.BaseRenderer()
  pr.start(200,200)
  pr.line(0,0,100,100)
  pr.line(0,100,100,0)
  pr.saveLocal( "x.png" )
  pr.stop()
  
If python throws an unhandled exception while the renderer is running, it will stall forever. Some sugar to handle that:


  from prender import processing
  pr = processing.BaseRenderer()
  
  def draw(xx):
    xx.line(0,0,100,100)
    xx.line(0,100,100,0)
    xx.saveLocal( "x.png" )
    raise Exception( "random problem" )
  
  pr.execute( 200, 200, draw )
  
The execute() method runs the function draw() until it finishes or catches an exception, at which point it stops the 
renderer.

The class "MapRenderer" is helpful for rendering maps

  from prender import processing
  mr = processing.MapRenderer()
  mr.start(-500,-500,500,500,500) #left,bottom,right,top,width
  mr.background(255,255,255)
  mr.line(-500,-500,500,500) #from lower-lefthand to upper-righthand
  mr.saveLocal("map.png")
  mr.stop()

==== INSTALLATION INSTRUCTIONS ====

--== Compile rendering server ==--

1) Open renderer/renderer.pde in Processing
2) Run it. It should throw an error along the lines of.
  "java.lang.ClassCastException: renderer cannot be cast to processing.core.PApplet
    at processing.core.PApplet.main(PApplet.java:6486)"
3) Go to "File"->"Export Application" and export a linux application.

--== Install rendering server ==--

$ sudo make install

--== Install python client library ==--

$ sudo python setup install

--== Test ==--

$ cd prender
$ python processing.py

If everything is working properly, several images should show up in the local directory. You can delete them; they don't 
do anything.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server