【问题标题】:python turtle Name error: shape is not defined [duplicate]python海龟名称错误:未定义形状[重复]
【发布时间】:2020-10-17 23:02:14
【问题描述】:

当我在 Mac os 中尝试使用 python 3.8.3 这段代码:

from turtle import *
shape("turtle")

我收到此错误:

Traceback (most recent call last):
  File "C:\Users\jeeva\Desktop\Tanmay_new\python\pi\Draw_pi\draw_pi.pyw", line 2, in <module>
    shape("turtle")
NameError: name 'shape' is not defined

看起来 python 不能重新调整形状。
请帮帮我。

【问题讨论】:

  • 你试过使用 shape=('turtle')
  • 感谢您的建议,但它会将一个名为 shape 的变量设置为 'turtle' 的值。

标签: python macos turtle-graphics python-3.8 python-turtle


【解决方案1】:

看看你是否有一个名为 turtle.py 的文件而不是模块。重命名并重试

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多