Modifications

Sauter à la navigation Sauter à la recherche
576 octets ajoutés ,  22 mars 2020 à 11:58
Ligne 119 : Ligne 119 :     
[[Fichier:Python-Turtle-Exemple2-11c.png]]
 
[[Fichier:Python-Turtle-Exemple2-11c.png]]
 +
 +
== Remplissage ==
 +
Dans l'exemple suivant, {{fname|begin_fill()}} et {{fname|end_fill()}} sont utilisés pour remplir un polygone (un triangle) dessiné avec la tortue.
 +
 +
<syntaxhighlight lang="python">
 +
import turtle
 +
t = turtle.Turtle()
 +
t.fillcolor('yellow')
 +
# Faire un triangle SANS remplissage
 +
t.forward(50)
 +
t.right(90)
 +
t.forward(50)
 +
t.right(135)
 +
t.forward(71)
 +
# Faire un triangle AVEC remplissage
 +
t.begin_fill()
 +
t.forward(50)
 +
t.right(90)
 +
t.forward(50)
 +
t.right(135)
 +
t.forward(71)
 +
t.end_fill()</syntaxhighlight>
 +
 +
Résultat attendu:
 +
 +
[[Fichier:Python-Turtle-Exemple2-14.png]]
    
== Variables ==
 
== Variables ==
29 836

modifications

Menu de navigation