我正在使用PyGame用Python 3.7制作我自己的“游戏引擎”。我想创建一个使用pygame.rect()
函数的类,但是当我运行它时,每次都会出现这个错误或类似的错误
main.py(./pyseed/)
# Imports
import pygame
pygame.init()
# class
class Shape:
def __init__(self, width, height, color):
self.width = width
self.height = height
self.color = color
self.SHAPE = pygame.rect(self, width, height, color)
# RunApp() function
def runApp(width, height):
screen = pygame.display.set_mode((width, height))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
pygame.display.flip()
testing.py(import main
将更改为import pyseed.main
)
# PySeed Testing Zone
import main as pyseed
myShape = pyseed.Shape(90, 90, (0, 100, 255))
pyseed.runApp(400, 300)
谢谢你的帮助
我的新代码:
main.py
测试.py
谢谢你的帮助
相关问题 更多 >
编程相关推荐