def widget_factory(self): widget = ScatterPlane(size=self.size) widget.center = self.pos with widget.canvas: if self.texture: Rectangle(pos=(0, 0), texture=self.texture, size=self.size) else: Color(0, 0, 1, 1) Rectangle(pos=(0, 0), size=self.size) return widget
def widget_factory(self): widget = ScatterPlane(size=self.size) widget.center = self.pos with widget.canvas: if not self.texture: Color(1, 0, 1, 1) Ellipse(pos=(0, 0), size=self.size) else: Ellipse(pos=(0, 0), texture=self.texture, size=self.size) return widget
def add_static_rect(self): body = cy.Body() box = cy.Poly.create_box(body, size=(200., 100.)) box.elasticity = 0. body.position = 400., 100. self.space.add(box) widget = ScatterPlane(size=(200., 100.)) with widget.canvas: Color(0., 1, 0, 1) Rectangle(pos=(0, 0), size=(200, 100)) self.add_widget(widget) widget.center = body.position.x, body.position.y