[python/turtle] Added write method

Allows user to print strings with the turtle

Change-Id: I06a3832f6fa36d29506be10c48a1b2fb34cb69fb
This commit is contained in:
Arthur
2020-05-19 17:48:37 +02:00
committed by Émilie Feral
parent 7cd0b7e0e0
commit fe7c4b1a8a
5 changed files with 27 additions and 0 deletions

View File

@@ -193,3 +193,9 @@ mp_obj_t modturtle_hideturtle() {
mp_obj_t modturtle_isvisible() {
return sTurtle.isVisible() ? mp_const_true : mp_const_false;
}
mp_obj_t modturtle_write(mp_obj_t s) {
const char * string = mp_obj_str_get_str(s);
sTurtle.write(string);
return mp_const_none;
}