Saturday, January 21, 2017

Jython 4. Arc

This Example, Arc, will produce the same output as Java Example 4.


# ex04.py
# Arc

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 Arc
from javafx.scene.shape import ArcType

def getPos():
    pos = []
    pos.extend([200,200]) # center x,y
    pos.extend([100,100]) # radius x,y
    pos.extend([0,270]) # start and end angles
    return pos

class Ex04(Application):
    def start(self, stage):
        stage.setTitle("Example 4. Arc")
        root = Group()
        
        pos = getPos()
        arc = Arc(*pos)
        arc.setType(ArcType.ROUND)
        arc.setFill(Color.RED)
        root.getChildren().add(arc)
        
        scene = Scene(root, 400, 400, Color.AZURE)
        stage.setScene(scene)
        stage.show()

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

No comments:

Post a Comment