Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Déplacer les cellules d’un carnet

Comme nous l’avons vu, l’ordre d’execution des cellules est important (voire priordial) dans un carnet. Aussi lorsque l’on construit progressivement un carnet, il est souhaitable de régulièrement le restructurer pour que ses cellules soient l’ordre souhaité d’exécution.

# Étape 2
def unarrondi(orientation, avancer):
    if orientation == "L":
        for i in range(0, 45):
            t.left(2)
            t.forward(1)
    else:
        for i in range(0, 45):
            t.right(2)
            t.forward(1)
    if avancer == "V":
        t.forward(60)
# Étape 7
t.forward(15)
unarrondi("R", "V")
unarrondi("R", "F")
t.forward(70)
t.left(90)
t.forward(12)
t.left(90)
t.forward(45)
t.right(90)
t.forward(20)
unarrondi("R", "V")
t.forward(2)
unarrondi("R", "F")
t.forward(45)
unarrondi("R", "V")
t.forward(10)
unarrondi("L", "F")
t.forward(45)
# Étape 3
t.penup()
t.left(90)
t.forward(90)
# Étape 1
from mobilechelonian import Turtle

t = Turtle()
t.speed(20)
# Étape 5
t.forward(45)
t.right(90)
t.forward(12)
t.right(90)
t.forward(70)
unarrondi("L", "V")
unarrondi("L", "F")
t.forward(15)
t.left(90)
t.forward(30)
unarrondi("R", "V")
t.forward(10)
unarrondi("L", "V")
# Étape 6
t.penup()
t.right(180)
t.forward(20)
t.left(90)
t.forward(10)
t.pencolor("yellow")
t.pendown()
# Étape 4
t.pendown()
t.forward(10)
t.pencolor("blue")
unarrondi("L", "V")
unarrondi("L", "F")
t.forward(20)
t.left(90)

Bilan

Pour savez maintenant déplacer les cellules pour facilement réorganiser vos carnets.