0

I did this on pycharm and when i ran the code the thing that is the visual version of the code would pop up but have a black background and at the bottom of the code it would say:

Traceback (most recent call last):


This is what the error said
File "<input>", line 1, in <module>
File "C:\Users\cex-birmingham\Desktop\PyCharm Community Edition 2021.1.1\plugins\python- 
ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
File "C:\Users\cex-birmingham\Desktop\PyCharm Community Edition 2021.1.1\plugins\python- 
ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/cex-birmingham/PycharmProjects/pygame and python/main.py", line 10, in 
<module>
ball = pygame.Circle(35, 240, 30, 30)
AttributeError: module 'pygame' has no attribute 'Circle' 

this is me using pygame

import pygame

pygame.init()
wn = pygame.display.set_mode([1000,600])
pygame.display.set_caption("Pong game by Tayoni")
player1 = pygame.Rect(5, 240, 15, 140)
player2 = pygame.Rect(980, 240, 15, 140)
ball = pygame.Circle(35, 240, 30, 30)
red = (255, 0, 0)
orange = (255, 128, 0)
yellow = (255, 255, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
indigo = (128, 0,255)
fuchsia = (255, 0, 255)
white = (255, 255, 255)
grey = (128, 128, 128)
black = (0, 0, 0)
def display():
pygame.draw.rect(wn, fuchsia, player1)
pygame.draw.rect(wn, fuchsia, player2)
pygame.draw.Circle(wn, blue, ball)
pygame.draw.rect(wn, grey, )


running = True
while running:
for event in pygame .event.get():
        if event.type == pygame.QUIT:
            running = False
display()
pygame.display.update()
circle()**
Janez Kuhar
  • 3,096
  • 2
  • 22
  • 39

0 Answers0