I have a pygame game and I want to use pygame.gfxdraw.aacricle(), but whenever I do it gives me an error:
AttributeError: 'module' object has no attribute 'gfxdraw'
How do I install gfx for python 2.7?
pygame.gfxdraw. pygame module for drawing shapes.
To run the program, double-click the . bat file. It will pop up a black console window and then your pygame window should appear. When you close the pygame window, the console window will remain with the message "Hit any key to continue…".
The pygame library is an open-source module for the Python programming language specifically intended to help you make games and other multimedia applications. Built on top of the highly portable SDL (Simple DirectMedia Layer) development library, pygame can run across many platforms and operating systems.
Open a terminal, and type 'sudo apt-get install idle pygame', enter your password and type 'y' at the prompts, if necessary. 2. After the installation completes, enter 'python' in the terminal to launch Python. Verify that it's using version 2.7 or newer, then at the Python prompt enter 'import pygame'.
I had this same issue using gfxdraw in pygame as well. Once I imported the module explicitly, there were no issues. Adding this line after importing pygame fixed the issue:
import pygame.gfxdraw
Curiously, I don't need to import pygame.draw explicitly in order to use it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With