Sunday, January 22, 2017

Jython 7. QuadCurve

This Example, QuadCurve, will produce the same output as Java Example 7.


# ex07.py
# QuadCurve

from javafx.application import Application
from javafx.scene import Scene
from javafx.scene import Group
from javafx.scene.paint import Color
from javafx.scene.shape import QuadCurve

class Pos:
    pass

pos = Pos()
pos.start = [0,200] # start x,y
pos.control = [200,0] # control x,y
pos.end = [400,200] # end x,y
pos.val = pos.start + pos.control + pos.end

class Ex07(Application):
    def start(self, stage):
        stage.setTitle("Example 7. QuadCurve")
        root = Group()
        
        quad = QuadCurve(*pos.val)
        quad.setFill(Color.RED)
        
        root.getChildren().add(quad)
        
        scene = Scene(root, 400, 400, Color.GHOSTWHITE)
        stage.setScene(scene)
        stage.show()

if __name__ == '__main__':
    Application.launch(Ex07().class, [])

No comments:

Post a Comment