求python大佬帮忙看一下问题在哪
这是源代码:课上一个画小蛇的程序importturtledefdrawSnake(rad,angle,len,neckrad):foriinrange(len):turt...
这是源代码:
课上一个画小蛇的程序
import turtle
def drawSnake(rad, angle, len, neckrad):
for i in range(len):
turtle.circle(rad, angle)
turtle.circle(-rad, angle)
turtle.circle(rad, angle / 2)
turtle.fd(rad)
turtle.circle(neckrad + 1, 180)
turtle.fd(rad * 2 / 3)
def main():
turtle.setup(1300, 800, 0, 0)
pythonsize = 30
turtle.pensize(pythonsize)
turtle.pencolor("blue")
turtle.seth(-40)
drawSnake(40, 80, 5, pythonsize / 2)
main()
这是运行后报错的内容:
Traceback (most recent call last):
File "Untitled.py", line 1, in <module>
import turtle
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/turtle.py", line 107, in <module>
import tkinter as TK
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter' 展开
课上一个画小蛇的程序
import turtle
def drawSnake(rad, angle, len, neckrad):
for i in range(len):
turtle.circle(rad, angle)
turtle.circle(-rad, angle)
turtle.circle(rad, angle / 2)
turtle.fd(rad)
turtle.circle(neckrad + 1, 180)
turtle.fd(rad * 2 / 3)
def main():
turtle.setup(1300, 800, 0, 0)
pythonsize = 30
turtle.pensize(pythonsize)
turtle.pencolor("blue")
turtle.seth(-40)
drawSnake(40, 80, 5, pythonsize / 2)
main()
这是运行后报错的内容:
Traceback (most recent call last):
File "Untitled.py", line 1, in <module>
import turtle
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/turtle.py", line 107, in <module>
import tkinter as TK
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter' 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询