def __get_dbg_origin_gfx(self): if self.__dbg_origin is None: c1 = Color(1, 0, 0, 0.5) r1 = Rectangle() c2 = Color(0, 1, 0, 0.5) r2 = Rectangle() c3 = Color(0, 0, 1, 0.5) e = Ellipse() group = InstructionGroup() for instruction in (c1, r1, c2, r2, c3, e): group.add(instruction) def update_geom(_, (w, h)): r1.size = (w, 0.1 * h) r2.size = (0.1 * w, h) e.size = (0.5 * w, 0.5 * h) e.pos = (0.25 * w, 0.25 * h) self.bind(viewport_size=update_geom) update_geom(None, self.size) self.__dbg_origin = group