И в классе Ball есть метод draw, но мне пишет, что ‘module’ object has no attribute ‘draw’ . Спасибо заранее.
import pygame, sys import Hello import Ball pygame.init() screen = pygame.display.set_mode((640, 360), 0, 32) color = (23, 213, 54) ball = Ball() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() screen.fill(color) d = Hello.obj1 ball.draw() pygame.display.update()
import pygame from Main import screen class Ball(): def __init__(self): self.x = 200 self.radius = 15 self.y = 50 self.color = (12, 35, 67) def draw(self): pygame.draw.circle(screen, self.color, (self.x, self.y), self.radius)
Почему в Ball есть draw, а он мне пишет, что нет его?
Как мне просто создать объект в классе Main из другого класса?