def render(self, show=True): duration = int(1000 * (time.time() - self.render_timestamp)) zero_img = np.zeros(self.last_image.shape, np.uint8) result = Tagging.attach( zero_img, BejeweledState.one_hot_state_to_prediction(self._state_queue[0])) cv2.putText(result, '%s ms' % duration, (15, 35), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (100, 100, 100), 3) if show: cv2.imshow('Sprites', result) cv2.moveWindow('Sprites', 0, 0) cv2.waitKey(1) self.render_timestamp = time.time() return result