recommend a graphics library for plotting by the pixel?
Adam Funk
a24061 at ducksburg.com
Wed Oct 5 09:29:38 EDT 2011
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.
More information about the Python-list
mailing list