Work inside google colab
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- r
调研方向
在 Google Colab 中通过反复调用 .turtle_undraw() 重现该行为,然后阅读 .turtle_undraw() 和 .turtle_draw() 的实现,并比较 grid.remove() 如何处理 redraw=FALSE。完成的标准是:移除 turtle 时不会在每次调用时创建新的图形区域,即使在反复绘制和取消绘制之后也是如此。
由索引模型根据 Issue 内容生成。
描述
Hi,
Would it be possible to make the package work correctly inside google colab? The problem I noticed (there may be others) is that .turtle_undraw() uses grid.remove(), which causes colab to create a new graphic area at every call. I tried to change .turtle_undraw():
.turtle_undraw <- function()
{
grid.remove("turtle_head", redraw=FALSE)
grid.remove("turtle_body", redraw=FALSE)
grid.remove("turtle_leg1", redraw=FALSE)
grid.remove("turtle_leg2", redraw=FALSE)
grid.remove("turtle_leg3", redraw=FALSE)
grid.remove("turtle_leg4", redraw=FALSE)
invisible(NULL)
}
But this does not remove/undraw the turtle. Eliminating redraw=FALSE from just the last line does remove/undraw the turtle and reduces the number of bogus graphic areas, but that is not a solution.
As a workaround, I eliminated the turtle image completely:
library("TurtleGraphics")
fakedraw <- function() {invisible(NULL)}
environment(fakedraw) <- asNamespace('TurtleGraphics')
assignInNamespace(".turtle_draw",fakedraw, ns="TurtleGraphics")
assignInNamespace(".turtle_undraw",fakedraw, ns="TurtleGraphics")
turtle_init()
which is obviously not great but apparently works ok, at least for simple stuff.
Thanks!
- 主要语言
- HTML
- 星标
- 23
- 派生
- 10
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
gagolews/TurtleGraphics 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
gagolews/TurtleGraphics#28 · 3 条评论 ·
查看 gagolews/TurtleGraphics 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
FriendsofECCE/ECCE#1353 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
ly05010419/MacNativeGames#2428 ·
维护者通常 1 天内回复
-
area:2d bug effort:high P7 source:agent
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
SixLabors/ImageSharp.Drawing#438 · 1 条评论 ·