pygame / examples / scrap_clipboard.py

Diff from to

examples/scrap_clipboard.py

 import StringIO
 
 def usage ():
-    print "Press the 'g' key to get all of the current clipboard data"
-    print "Press the 'p' key to put a string into the clipboard"
-    print "Press the 'a' key to get a list of the currently available types"
-    print "Press the 'i' key to put an image into the clipboard"
+    print ("Press the 'g' key to get all of the current clipboard data")
+    print ("Press the 'p' key to put a string into the clipboard")
+    print ("Press the 'a' key to get a list of the currently available types")
+    print ("Press the 'i' key to put an image into the clipboard")
 
 main_dir = os.path.split(os.path.abspath(__file__))[0]
 
 
         elif e.type == KEYDOWN and e.key == K_g:
             # This means to look for data.
-            print "Getting the different clipboard data.."
+            print ("Getting the different clipboard data..")
             for t in scrap.get_types ():
                 r = scrap.get (t)
                 if r and len (r) > 500:
-                    print "Type %s : (large buffer)" % t
+                    print ("Type %s : (large buffer)" % t)
                 else:
-                    print "Type %s : %s" % (t, r)
+                    print ("Type %s : %s" % (t, r))
                 if "image" in t:
                     namehint = t.split("/")[1]
                     if namehint in ['bmp', 'png', 'jpg']:
 
         elif e.type == KEYDOWN and e.key == K_p:
             # Place some text into the selection.
-            print "Placing clipboard text."
+            print ("Placing clipboard text.")
             scrap.put (SCRAP_TEXT, "Hello. This is a message from scrap.")
 
         elif e.type == KEYDOWN and e.key == K_a:
             # Get all available types.
-            print "Getting the available types from the clipboard."
+            print ("Getting the available types from the clipboard.")
             types = scrap.get_types ()
-            print types
+            print (types)
             if len (types) > 0:
-                print "Contains %s: %s" % (types[0], scrap.contains (types[0]))
-                print "Contains _INVALID_: ", scrap.contains ("_INVALID_")
+                print ("Contains %s: %s" % (types[0], scrap.contains (types[0])))
+                print ("Contains _INVALID_: ", scrap.contains ("_INVALID_"))
 
         elif e.type == KEYDOWN and e.key == K_i:
-            print "Putting image into the clipboard."
+            print ("Putting image into the clipboard.")
             scrap.set_mode (SCRAP_CLIPBOARD)
             fp = open (os.path.join(main_dir, 'data', 'liquid.bmp'), 'rb')
             buf = fp.read ()
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.