python中有没有一种方法(使用turtle)来绘制圆柱体?(从数组中读取高度、半径和体积)
我想知道是否有任何方法可以使用pythonturtle(使用数组中的数据(半径、体积和高度))绘制圆柱体/隧道 允许我使用的模块列表如下:python中有没有一种方法(使用turtle)来绘制圆柱体?(从数组中读取高度、半径和体积),python,3d,python-turtle,Python,3d,Python Turtle,我想知道是否有任何方法可以使用pythonturtle(使用数组中的数据(半径、体积和高度))绘制圆柱体/隧道 允许我使用的模块列表如下: -astropy v1.3.2 -靓汤v4.6.0 -加密v1.8.1 -烧瓶v1.1.1 -lxml v4.1.1 -numpy v1.12.1 -matplotlib v3.0.3 -熊猫v0.19.1 -PeakUtils v1.1.0 -枕头:Python图像库(PIL)v4.1.0 -psycopg2 v2.7.1 -PySAL v1.13.0 -
-astropy v1.3.2
-靓汤v4.6.0
-加密v1.8.1
-烧瓶v1.1.1
-lxml v4.1.1
-numpy v1.12.1
-matplotlib v3.0.3
-熊猫v0.19.1
-PeakUtils v1.1.0
-枕头:Python图像库(PIL)v4.1.0
-psycopg2 v2.7.1
-PySAL v1.13.0
-请求v2.18.4
-RunStats v1.6.3
-scikit学习v0.18.1
-scipy v0.19.0
-分类容器v1.5.7
-Statsmodels v0.8.0
有人能告诉我怎么做吗?(附代码)
提前感谢。试着以此为起点:
from turtle import *
height = 100
radius = 20
color(0.2, 0.5, 0.8)
forward(height)
circle(radius)
setheading(90)
penup()
forward(2*radius)
pendown()
setheading(180)
forward(height)
circle(radius, extent=180) # Draw 1/2 of the bottom/circle
done()
一种可能的方法是使用图章通过海龟: 但缺乏真实的视角:
这就是我必须画一个圆柱体的地方
pendown()
#starts to draw
turtle.reset()
#clears the drawing space
circle(radius*10)
forward(length*10)
circle(radius*10, 180)
forward(length*10)
penup()
right(90)
forward(100*10)
#gets the turtle out of the way
#draws a cylinder
欢迎来到堆栈溢出。在提问时请尽量具体,这是一个指南。当我运行它时,它会显示:回溯(最近一次调用最后一次):文件“program.py”,第8行,在shapesize(半径*2/光标大小,高度/光标大小)文件“/opt/grok/python3/turtle.py”,第2281行,在shapesize raise NotImplementedError中(“当前不支持
shapesize
函数”。)NotImplementedError:shapesize
函数当前不受支持。@EricCao,您使用的不是标准的Python版本,而是其他一些环境。当您提出问题时,您应该清楚地说明这些环境的细节。下面是我正在运行的内容的快照:@EricCao,那似乎是你的编辑环境,你用什么来运行代码?Grok Learning我用python终端运行它
pendown()
#starts to draw
turtle.reset()
#clears the drawing space
circle(radius*10)
forward(length*10)
circle(radius*10, 180)
forward(length*10)
penup()
right(90)
forward(100*10)
#gets the turtle out of the way
#draws a cylinder