I got used to blit every image into the screen on a seperate line in Pygame but now I want to start using the pygame.Surface.blits() method.

According to the documentation, it draws many images into another and it accepts a blit_sequence parameter.

So here is what I've tried:

MyScreen.blits([img1, img2, img3], [(230, 598), (350, 598),(470, 598)])

This led to an error : TypeError: an integer is required (got type list)

I also tried this :

MyScreen.blits([img1, (230, 598)], [img2, (350, 598)], [img3, (470, 598)])

This made the terminal throw another TypeError: function takes at most 2 arguments (3 given)

I tried the same last example but with tuples but it didn't work.


I've taken a look at this post in which a very similar problem was discussed and I realized that there's an issue with that method but that post is 2 years old until now, so aren't there any solutions ?


1 Answer 1


The documentation for blits says that the syntax is

blits(blit_sequence=(source, dest), ...), doreturn=1)

I am not sure if there is intentionally an opening parenthesis missing there, but it's easy to deduce that the required syntax is blits(sequenceOfPairsOfSurfaceDestination), meaning that your second attempt is close, but missing the outer sequence, as you are simply trying to pass each of the elements of the sequence as parameter to the function.

So what you want is

surface.blits(((surface1, dest1), (surface2, dest2)))

Notice that we are only passing in one argument, which here is a tuple of tuples. If the amount of parentheses is confusing, feel free to break it up into separate variables until you can understand the individual elements.

  • \$\begingroup\$ Thanks a lot ! That missing opening parenthesis did really confuse me. \$\endgroup\$
    – Salem
    Commented Aug 5, 2021 at 16:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .