gpt4 book ai didi

python - 无法在 python 中停止 nameerror

转载 作者:太空宇宙 更新时间:2023-11-04 11:10:45 24 4
gpt4 key购买 nike

当我输入这个...

class doorsprite(Sprite):
def __init__(self, game, photo_image, x, y, width, height):
Sprite.__init__(self, game)
self.photo_image = photo_image
self.image = game.canvas.create_image(x, y, \
image=self.photo_image, anchor='nw')
self.coordinates = Coords(x, y, x + (width / 2), y + height)
self.endgame = True

我明白了...

Traceback (most recent call last):
File "C:\Users\telta\Desktop\stickman game.py", line 94, in <module>
class DoorSprite(Sprite):
NameError: name 'Sprite' is not defined

最佳答案

你可能正在从书A playing introduction on programming中读到这本书你错过了本书后面给出的 Sprite 类。可以回头搜索sprite函数。玩得开心建筑火柴人游戏。谢谢。

关于python - 无法在 python 中停止 nameerror,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58281128/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com