pygame / examples / blit_blends.py

Diff from to

examples/blit_blends.py

     import pygame.surfarray
     import Numeric
 except:
-    print "no surfarray for you!  install Numeric"
+    print ("no surfarray for you!  install Numeric")
 
 import time
         
     screen.blit(im1, (0, 0))
     pygame.display.flip()
     clock = pygame.time.Clock()
-    print "one pixel is:%s:" % [im1.get_at((0,0))]
+    print ("one pixel is:%s:" % [im1.get_at((0,0))])
 
     going = True
     while going:
                 # blits is a dict keyed with key -> blit flag.  eg BLEND_ADD.
                 im1.blit(img_to_blit, (0,0), None, blits[event.key])
                 t2 = time.time()
-                print "one pixel is:%s:" % [im1.get_at((0,0))]
-                print "time to do:%s:" % (t2-t1)
+                print ("one pixel is:%s:" % [im1.get_at((0,0))])
+                print ("time to do:%s:" % (t2-t1))
 
 
             elif event.type == KEYDOWN and event.key in [K_t]:
 
                     # show which key we're doing...
                     onedoing = blitsn[bkey]
-                    print "time to do :%s: is :%s:" % (onedoing, t2-t1)
+                    print ("time to do :%s: is :%s:" % (onedoing, t2-t1))
 
 
             elif event.type == KEYDOWN and event.key in [K_o]:
                 # blits is a dict keyed with key -> blit flag.  eg BLEND_ADD.
                 im1.blit(iaa, (0,0))
                 t2 = time.time()
-                print "one pixel is:%s:" % [im1.get_at((0,0))]
-                print "time to do:%s:" % (t2-t1)
+                print ("one pixel is:%s:" % [im1.get_at((0,0))])
+                print ("time to do:%s:" % (t2-t1))
 
 
             elif event.type == KEYDOWN and event.key == K_SPACE:
                 del im1p
                 del im2p
                 t2 = time.time()
-                print "one pixel is:%s:" % [im1.get_at((0,0))]
-                print "time to do:%s:" % (t2-t1)
+                print ("one pixel is:%s:" % [im1.get_at((0,0))])
+                print ("time to do:%s:" % (t2-t1))
 
             elif event.type == KEYDOWN and event.key in [K_z]:
                 t1 = time.time()
                 del im1p
                 del im2p
                 t2 = time.time()
-                print "one pixel is:%s:" % [im1.get_at((0,0))]
-                print "time to do:%s:" % (t2-t1)
+                print ("one pixel is:%s:" % [im1.get_at((0,0))])
+                print ("time to do:%s:" % (t2-t1))
 
             elif event.type == KEYDOWN and event.key in [K_r, K_g, K_b]:
                 # this adds one to each pixel.
                 im1p = pygame.surfarray.pixels2d(im1)
                 im1p += colmap[event.key]
                 del im1p
-                print "one pixel is:%s:" % [im1.get_at((0,0))]
+                print ("one pixel is:%s:" % [im1.get_at((0,0))])
 
             elif event.type == KEYDOWN and event.key == K_p:
-                print "one pixel is:%s:" % [im1.get_at((0,0))]
+                print ("one pixel is:%s:" % [im1.get_at((0,0))])
 
 
 
                 im1.set_alpha(255)
 
                 t2 = time.time()
-                print "one pixel is:%s:" % [im1.get_at((0,0))]
-                print "time to do:%s:" % (t2-t1)
+                print ("one pixel is:%s:" % [im1.get_at((0,0))])
+                print ("time to do:%s:" % (t2-t1))
 
 
         screen.blit(im1, (0, 0))
     pygame.quit()
 
 def usage():
-    print "press keys 1-5 to change image to blit."
-    print "A - ADD, S- SUB, M- MULT, - MIN, + MAX"
-    print "T - timing test for special blend modes."
+    print ("press keys 1-5 to change image to blit.")
+    print ("A - ADD, S- SUB, M- MULT, - MIN, + MAX")
+    print ("T - timing test for special blend modes.")
 
 if __name__ == '__main__': 
     usage()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.