On Wed, Oct 05, 2011 at 02:29:38PM +0100, Adam Funk wrote: > On 2011-10-04, Derek Simkowiak wrote: > > > If this is strictly for 2D pixel graphics, I recommend using PyGame > > (aka SDL). Why do you not think it's the way to go? It was built for > > this type of thing. > > I only know PyGame because we did an exercise in recreating the old > breakout game and messing around with it at a local Python group. > > I was under the mistaken impression from that exercise that you have > to maintain a set of all the objects on the screen and redraw them all > every time through the loop that ends with pygame.display.flip() --- > *but* I now see that the loop starts with these: > > clock.tick(tick_rate) > screen.fill((0,0,0)) > # comes from screen = > pygame.display.set_mode((screen_width,screen_height)) > # before the loop > > and that I was then deleting hit bricks, calculating the new positions > of the balls, and then redrawing everything that was left on the > secondary screen because things were moving around and disappearing. > > I guess if I don't clear the screen at the beginning of the loop but > just blit pixels onto it, when I call display.flip(), it will add the > new blittings to what was already there? If that's true, this will be > much easier than I thought. > > The only buttons I have in mind are "pause", "step", "go", and "quit", > and I can just as easily do those with keypresses.
Yep. Blitting is replacing the old colors with new colors. It doesn't replace colors unless you tell it to. -- http://mail.python.org/mailman/listinfo/python-list