def step(self): for thing in self.items.itervalues(): thing.act() for pos, thing in self.items.iteritems(): gridpy.plot(thing.color(), pos) gridpy.update()
def main_loop(self): while True: self.game.tick() #print "--- Game Matrix ---" #print self.game for cell, position in self.game.cells(): gridpy.plot(GUI.CELL_COLOR, position) gridpy.update() gridpy.clear()
#gridpy.set_style(gridpy.NONE) gridpy.title("A simple demo") gridpy.show() def cycle(list): while True: for item in list: yield item rainbow = cycle([ gridpy.CYAN, gridpy.YELLOW, gridpy.MAGENTA, gridpy.RED, gridpy.GREEN, gridpy.BLUE, gridpy.WHITE, gridpy.GREY, ]) while True: for c in xrange(gridpy.cols()): color = rainbow.next() for r in xrange(gridpy.rows()): location = (c, r) gridpy.plot(color, location) gridpy.update() gridpy.remove(location) #gridpy.clear()