recommend a graphics library for plotting by the pixel?

Adam Funk a24061 at ducksburg.com
Fri Oct 7 16:15:43 EDT 2011


On 2011-10-05, Westley Martínez wrote:

> On Wed, Oct 05, 2011 at 02:29:38PM +0100, Adam Funk wrote:

>> 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.

> Yep.  Blitting is replacing the old colors with new colors.  It doesn't
> replace colors unless you tell it to.

My mistake was in sample code, running with it, & not looking at it
too closely.  ;-)


-- 
Mathematiker sind wie Franzosen: Was man ihnen auch sagt, übersetzen
sie in ihre eigene Sprache, so daß unverzüglich etwas völlig anderes
daraus wird.                                                [Goethe]



More information about the Python-list mailing list