【问题标题】:mobilechelonian fails to draw in jupyter notebookmobilechelonian 无法在 jupyter notebook 中绘图
【发布时间】:2021-02-17 09:30:21
【问题描述】:

我尝试了 mobilechelonian 模块以在不同云中的 python jupyter notebook 中使用海龟(谷歌协作或我学校可用的服务器)。在两台服务器上,模块都可以安装或已经安装:

%pip install mobilechelonian

yields(前三行):

Requirement already satisfied: mobilechelonian in /opt/conda/lib/python3.8/site-packages (0.5)
Requirement already satisfied: ipywidgets>=7.0.0 in /opt/conda/lib/python3.8/site-packages (from mobilechelonian) (7.6.3)
Requirement already satisfied: IPython in /opt/conda/lib/python3.8/site-packages (from mobilechelonian) (7.19.0)
Requirement already satisfied: pygments in /opt/conda/lib/python3.8/site-packages (from IPython->mobilechelonian) (2.7.2)

我只是将演示代码复制并粘贴到一个单元格中:

from mobilechelonian import Turtle
t = Turtle()
t.speed(5)
colours=["red","blue","yellow","brown","black","purple","green"]

t.penup(); t.left(90); t.forward(200);t.right(90);t.pendown()
for i in range (0,18):
    t.pencolor(colours[i%7])
    t.right(20)
    t.forward(50)

t.right(180)
t.home()
 

结果不是waited colored polygon,而是一个带有输出的单元格:

Turtle()

感谢您提出解决此问题的建议。

【问题讨论】:

    标签: python python-3.x jupyter-notebook turtle-graphics python-turtle


    【解决方案1】:

    由于某些原因,笔记本从经典的 jupyter notebook 启动时会显示绘图,而从 jupyterlab 启动时会失败。

    【讨论】:

      猜你喜欢
      • 2018-12-10
      • 1970-01-01
      • 1970-01-01
      • 2021-11-15
      • 2016-10-10
      • 2018-01-10
      • 2023-02-06
      • 2016-08-05
      • 2017-05-11
      相关资源
      最近更新 更多