Python error: argument 1 must be pygame.surface.Surface, not builtin_function_or_method solution

1. Error analysis :

According to the error message, we are prompted that the reason for the error is that the first parameter type must be the pygame type, but our parameter type does not match.

2. Source code analysis

The first parameter in the method blit() here is STATICSURF, a global constant. According to the error we know that it is a problem. We find the assignment code for this parameter.

3. STATICSURF parameter analysis

Here we find that STATICSURF is assigned by WINSET.copy, where WINSET.copy returns a function object, but what we need is to return a Surface window object

4. Correct spelling

Change WINSET.copy to WINSET.copy() so that the return value is a Surface object, and it will work.

Guess you like

Origin blog.csdn.net/weixin_62222095/article/details/129369009