Esempio n. 1
0
    def __init__(self):
        app.Canvas.__init__(self, keys='interactive')
        self.size = (800, 800)
        global pos
        self.visuals = []
        polygon = visuals.PolygonVisual(pos=pos,
                                        color=(0.8, .2, 0, 1),
                                        border_color=(1, 1, 1, 1))
        polygon.transform = transforms.STTransform(scale=(200, 200),
                                                   translate=(600, 600))
        self.visuals.append(polygon)

        ellipse = visuals.EllipseVisual(pos=(0, 0, 0),
                                        radius=(100, 100),
                                        color=(0.2, 0.2, 0.8, 1),
                                        border_color=(1, 1, 1, 1),
                                        start_angle=180.,
                                        span_angle=150.)
        ellipse.transform = transforms.STTransform(scale=(0.9, 1.5),
                                                   translate=(200, 200))
        self.visuals.append(ellipse)

        rect = visuals.RectangleVisual(pos=(600, 200, 0),
                                       height=200.,
                                       width=300.,
                                       radius=[30., 30., 0., 0.],
                                       color=(0.5, 0.5, 0.2, 1),
                                       border_color='white')
        rect.transform = transforms.NullTransform()
        self.visuals.append(rect)

        rpolygon = visuals.RegularPolygonVisual(pos=(200., 600., 0),
                                                radius=160,
                                                color=(0.2, 0.8, 0.2, 1),
                                                border_color=(1, 1, 1, 1),
                                                sides=6)
        rpolygon.transform = transforms.NullTransform()
        self.visuals.append(rpolygon)

        for v in self.visuals:
            v.tr_sys = transforms.TransformSystem(self)
            v.tr_sys.visual_to_document = v.transform

        self.show()
        self._timer = app.Timer('auto', connect=self.on_timer, start=True)
Esempio n. 2
0
    def __init__(self):
        app.Canvas.__init__(self, keys='interactive', size=(800, 800))
        global pos
        self.visuals = []
        polygon = visuals.PolygonVisual(pos=pos,
                                        color=(0.8, .2, 0, 1),
                                        border_color=(1, 1, 1, 1),
                                        border_width=3)
        polygon.transform = transforms.STTransform(scale=(200, 200),
                                                   translate=(600, 600))
        self.visuals.append(polygon)

        ellipse = visuals.EllipseVisual(center=(0, 0, 0),
                                        radius=(100, 150),
                                        color=(0.2, 0.2, 0.8, 1),
                                        border_color=(1, 1, 1, 1),
                                        border_width=3,
                                        start_angle=180.,
                                        span_angle=150.)
        ellipse.transform = transforms.STTransform(scale=(0.9, 1.5),
                                                   translate=(200, 300))
        self.visuals.append(ellipse)

        rect = visuals.RectangleVisual(center=(600, 200, 0),
                                       height=200.,
                                       width=300.,
                                       radius=[30., 30., 0., 0.],
                                       color=(0.5, 0.5, 0.2, 1),
                                       border_width=3,
                                       border_color='white')
        rect.transform = transforms.NullTransform()
        self.visuals.append(rect)

        rpolygon = visuals.RegularPolygonVisual(center=(200., 600., 0),
                                                radius=160,
                                                color=(0.2, 0.8, 0.2, 1),
                                                border_color=(1, 1, 1, 1),
                                                border_width=3,
                                                sides=6)
        rpolygon.transform = transforms.NullTransform()
        self.visuals.append(rpolygon)

        self.show()