Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between pygame.draw and pygame.gfxdraw

Tags:

python

pygame

My question is simple: What is the difference between using pygame.draw and pygame.gfxdraw? I've looked on the pygame documentation, but no one has told what the difference between them is.

like image 568
ThisIsAQuestion Avatar asked Sep 03 '12 22:09

ThisIsAQuestion


People also ask

How do you draw a straight line in Pygame?

Just put the line of code for the line you draw in the while loop and it should draw the line. Also put your "pygame. display. flip()" at the end of your loop.

How do you draw a circle in Pygame?

To draw a circle in your pygame project you can use draw. circle() function.


1 Answers

The draw function is a bit more stable, and also a bit faster that gfxdraw, although gfxdraw has more options, not only along the lines of antialiasing, but also drawing shapes. pygame.draw has only nine functions, whereas pygame.gfxdraw has 22 options, which include all 9 of the options supplied by draw. I recommend using gfxdraw even though its is "experimental" because it has more capabilities.

like image 145
Ben Schwabe Avatar answered Sep 27 '22 18:09

Ben Schwabe