From d7fb5c256ce03cb7c2422cfb6726ff4db408f98c Mon Sep 17 00:00:00 2001 From: Arthur Camouseigt Date: Mon, 8 Jun 2020 16:27:14 +0200 Subject: [PATCH] [turtle] Fixed remanent images bug We now erase the turtle before writing text. This way we can redraw it on top of it, preventing overlapping and remanent images. Those scripts are causing issues : goto(-30,50) write('coucou') left(270) goto(30,50) write('oui') ----------- up() goto(-30,50) write('coucou') goto(30,50) write('oui') Change-Id: I01a6e5f8308937b5051165548c2046883da587d2 --- python/port/mod/turtle/turtle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/port/mod/turtle/turtle.cpp b/python/port/mod/turtle/turtle.cpp index 5c506e576..0b8f85c90 100644 --- a/python/port/mod/turtle/turtle.cpp +++ b/python/port/mod/turtle/turtle.cpp @@ -176,8 +176,8 @@ void Turtle::setVisible(bool visible) { } void Turtle::write(const char * string) { - // To prevent overlapping between the text and the turtle, force redraw - m_drawn = false; + // We erase the turtle to redraw it on top of the text + erase(); MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox(); KDContext * ctx = KDIonContext::sharedContext(); static constexpr KDCoordinate headOffsetLength = 6;