Open liavkoren opened 6 years ago
Those are already supported; see the WithStatements example.
Ah, okay. What confused me is that with beginShape()
doesn't work if called on an PGraphic instance -- looks like __exit__
hasn't been implemented on those?
def setup():
size(650, 650, P3D)
txt = createGraphics(650, 650)
with txt.beginDraw():
txt.line(0, 0, width, height)
image(txt, 0, 0)
Raises AttributeError.
I don't mind taking a kick at implementing this.
You're welcome to give it a shot. The tricky thing is that you'll have to modify createGraphics to return a Python object that wraps a PGraphics.
Do you have any advice on how to bootstrap myself with the project? Should I read about Jython first, or are there Processing.py files that capture the basic patterns, or..?
(O. You're the PeasyCam guy. 👍)
The project is https://github.com/jdf/processing.py, and the relevant source is in https://github.com/jdf/processing.py/tree/master/runtime/src/jycessing, with a lot of the bridge stuff in https://github.com/jdf/processing.py/blob/master/runtime/src/jycessing/core.py, and more in https://github.com/jdf/processing.py/blob/master/runtime/src/jycessing/PAppletJythonDriver.java. Here are instructions for working on the project: https://github.com/jdf/processing.py/blob/master/HOWTO-HACK.txt
Would remove the need to call
endShape
etc...