Work inside google colab

Đang mở
#33 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
r
Lĩnh vực
computer-graphics

Hướng nghiên cứu

Tái hiện hành vi trong Google Colab bằng cách gọi .turtle_undraw() nhiều lần, sau đó đọc các phần triển khai của .turtle_undraw() và .turtle_draw() rồi so sánh cách grid.remove() xử lý redraw=FALSE. Được xem là hoàn tất khi turtle được xóa mà không tạo một vùng đồ họa mới sau mỗi lần gọi, kể cả sau khi vẽ và xóa vẽ nhiều lần.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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!

Ngôn ngữ chính
HTML
Star
23
Fork
10
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của gagolews/TurtleGraphics

Tất cả issue của gagolews/TurtleGraphics

Issue tương tự

Thêm issue về Computer Graphics

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.