13 04 2008 jython processing Tweet
list 3-4-aをjythonで。
書いたコード。
from javax.swing import JFrame
from processing.core import PApplet
class Sketch(PApplet):
def __init__(self):
pass
def getField(self, name):
return self.class.superclass.getDeclaredField(name).get(self)
def setup(self):
self.size(800, 600)
self.colorMode(PApplet.HSB, self.width)
self.background(self.width-1)
self.noStroke()
self.frameRate(10)
def draw(self):
self.fill(self.mouseX, self.width*0.5, self.width-1)
self.ellipse(self.mouseX, self.mouseY, self.mouseY/2, self.mouseY/2)
def run(applet):
frame = JFrame(title="Processing",
resizable = 1,
defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
frame.contentPane.add(applet)
applet.init()
frame.pack()
frame.visible = 1
if __name__ == '__main__':
run(Sketch())