Mit Python: Ich versuche, ein Spiel zu machen, wo die Schildkröte nicht seine Schritte zurückverfolgen muss (ein bisschen wie Einzelspieler Tron), aber ich bekomme 'Ausnahme in Tkinter Rückruf 'wenn ich versuche, mein Programm zu starten. der Fehler ist:Python Turtle-Programm stirbt mit 'Ausnahme in Tkinter Rückruf' Fehler
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\GURNHH\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py", line 1550, in __call__
return self.func(*args)
File "C:\Users\GURNHH\AppData\Local\Programs\Python\Python35-32\lib\turtle.py", line 686, in eventfun
fun()
File "C:/Users/GURNHH/OneDrive - Rugby School/ICT/Python/bored.py", line 20, in k1
t.forward(10)
File "<string>", line 5, in forward
turtle.Terminator
und mein Programm ist:
import turtle as t
from turtle import *
setup(1200, 700)
Screen()
title("Turtle Keys")
showturtle()
turns = 0
badpos = []
def k1():
if t.pos in badpos and badpos.index(t.pos) == turns:
print("die")
print(t.pos)
t.color("red")
t.bye()
else:
pass
t.forward(10)
badpos.append(t.pos)
def k2():
t.left(90)
def k3():
t.right(90)
t.onkey(k1, "Up")
t.onkey(k2, "Left")
t.onkey(k3, "Right")
listen()
mainloop()