Anonymous avatar Anonymous committed a3e49f7

Surface.put_at cleanup

Comments (0)

Files changed (4)

docs/ref/Surface.html

 </tt></font><ul>
 Returns the RGB color values at a given pixel. If the
 Surface has no per-pixel alpha, the alpha will be 255 (opaque).
+The surface must be locked for this to work correctly.
 </ul><br>&nbsp;<br>
 
 <a name=get_bitsize><font size=+2><b>get_bitsize
 Surface.set_at([x, y], RGBA) -> None
 </tt></font><ul>
 Assigns RGBA color to the image at the give position.
+The surface must be locked for this to work correctly.
+<br>&nbsp;<br>
+In many situations just using the <a href=#fill>fill()</a> function with a one-pixel
+sized rectangle will be quicker. Also the fill function does not
+requirethe surface to be locked.
 </ul><br>&nbsp;<br>
 
 <a name=set_clip><font size=+2><b>set_clip

examples/aliens.py

     global last_tick, ticks_per_frame
     now = pygame.time.get_ticks()
     wait = ticks_per_frame - (now - last_tick)
-    #strange bug i'm hunting...
-    if type(wait) != type(1):
-        print 'attn: pete@shinners.org\n', wait, type(wait), now, type(now)
     pygame.time.delay(wait)
     last_tick = pygame.time.get_ticks()
 
     /*DOC*/    "\n"
     /*DOC*/    "Returns the RGB color values at a given pixel. If the\n"
     /*DOC*/    "Surface has no per-pixel alpha, the alpha will be 255 (opaque).\n"
+    /*DOC*/    "The surface must be locked for this to work correctly.\n"
     /*DOC*/ ;
 
 static PyObject* surf_get_at(PyObject* self, PyObject* arg)
     /*DOC*/    "set pixel at given position\n"
     /*DOC*/    "\n"
     /*DOC*/    "Assigns RGBA color to the image at the give position.\n"
+    /*DOC*/    "The surface must be locked for this to work correctly.\n"
+    /*DOC*/    "\n"
+    /*DOC*/    "In many situations just using the fill() function with a one-pixel\n"
+    /*DOC*/    "sized rectangle will be quicker. Also the fill function does not\n"
+    /*DOC*/    "requirethe surface to be locked.\n"
     /*DOC*/ ;
 
 static PyObject* surf_set_at(PyObject* self, PyObject* args)
 {
 	int ticks;
 	if(!PyArg_ParseTuple(arg, "i", &ticks))
+	{
+		printf("HMM, BAD ARGUMENTS.\nLet's try to troubleshoot this little bug...\n");
+		printf("Python Says you passed %d arguments.\n", PyTuple_Size(arg));
+		if(PyTuple_Size(arg)>= 1)
+		{
+			PyObject* arg1 = PyTuple_GET_ITEM(arg, 1);
+			printf("Argument 1 is type %s:", arg1->ob_type->tp_name);
+			PyObject_Print(arg1, stdout, Py_PRINT_RAW);
+		}
+		printf("Please report results to pygame@seul.org, thanks!\n");
+		printf("Here comes your exception, sorry.\n");
 		return NULL;
+	}
 
 	if(ticks < 0)
 		ticks = 0;
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.