(Python初学者,如果问题太幼稚,请原谅)在写着“Hello”的标签下方,创建一个标签或条形或其他任何东西来显示我的两只海龟的更新位置(我的意思是随着海龟移动其位置的两个坐标同时变化) import Tkinter import turtle
def run_turtles(*args):
for t, d in args:
t.circle(250, d)
root.after_idle(run_turtles, *args)
root = Tkinter.Tk()
root.withdraw()
frame = Tkinter.Frame(bg='black')
Tkinter.Label(frame, text=u'Hello', bg='grey', fg='white').pack(fill='x')
canvas = Tkinter.Canvas(frame, width=750, height=750)
canvas.pack()
frame.pack(fill='both', expand=True)
turtle1 = turtle.RawTurtle(canvas)
turtle2 = turtle.RawTurtle(canvas)
turtle1.ht(); turtle1.pu()
turtle1.left(90); turtle1.fd(250); turtle1.lt(90)
turtle1.st(); turtle1.pd()
turtle2.ht(); turtle2.pu()
turtle2.fd(250); turtle2.lt(90)
turtle2.st(); turtle2.pd()
root.deiconify()
run_turtles((turtle1, 3), (turtle2, 4))
root.mainloop()
非常非常感谢你!!