当应用程序试图打开时,我的游戏一直会遇到相同的错误代码(我几乎可以肯定这个问题与app.start有关,因为当我似乎把它拿出gui打开时。但是我得到一个完整的注释我不应该处理的一系列问题。)我在课堂上这样做,而且我的所有同伴似乎都有几乎相同的,如果不是相同的代码,但是根据这一部分并且所有似乎都有效?非常感谢你,如果你能找到我的代码没有运行的原因:(可能我只是遗漏了一些明显的东西,我对python和编程一般都是新手)
from appJar import gui
from turtle import *
people = ['Lachlan', 'Adrian', 'George', 'Aban', 'Joseph', 'Emulka', 'Shaniqua', 'Requise']
colours = ['red', 'yellow', ' cyan', 'purple', 'brown', 'black', 'white', 'blue']
def game ():
app.go()
bgcolor("light green")
title("RACING TURTLES")
speed(12)
penup()
goto(-160,110)
counter_names = 0
y = 100
while counter_names < 8:
people[counter_names] = Turtle()
people[counter_names].colour(colours[counter_names])
people[counter_names].shape('turtle')
people[counter_names].penup()
people[counter_names].goto(160, y)
people[counter_names].pendown()
counter_names = counter_names + 1
y = y - 20
game()
答案 0 :(得分:0)
您永远不会定义app
。
经过一些实验(我不熟悉龟),以下内容对我有用:
from appJar import gui
from turtle import *
people = ['Lachlan', 'Adrian', 'George', 'Aban', 'Joseph', 'Emulka', 'Shaniqua', 'Requise']
colours = ['red', 'yellow', 'cyan', 'purple', 'brown', 'black', 'white', 'blue']
def game():
bgcolor("light green")
title("RACING TURTLES")
speed(12)
penup()
goto(-160,110)
counter_names = 0
y = 100
while counter_names < 8:
people[counter_names] = Turtle()
people[counter_names].color(colours[counter_names])
people[counter_names].shape('turtle')
people[counter_names].penup()
people[counter_names].goto(160, y)
people[counter_names].pendown()
counter_names = counter_names + 1
y = y - 20
game()
with gui('mygame') as app:
app.go()