planets = [] dom = parse('planets.xml') xmlplanets = dom.getElementsByTagName('planet') for xmlplanet in xmlplanets: texture = "img/%s" % xmlplanet.getAttribute('texture') pattern = "Data/%s" % xmlplanet.getAttribute('pattern') radius = int(xmlplanet.getAttribute('radius')) planet = Planet(texture, str(pattern), radius) for moon in xmlplanet.childNodes: if moon.__class__.__name__ == 'Element': moon_texture = "img/%s" % moon.getAttribute('texture') planet.add_moon(Moon(moon_texture)) # if # for planets.append(planet) # for running = True while running: for event in pygame.event.get(): if event.type == QUIT or event.type == KEYDOWN and event.key == K_ESCAPE: running = False # for next_frame() glClear(GL_COLOR_BUFFER_BIT)