Modifications

Sauter à la navigation Sauter à la recherche
583 octets ajoutés ,  22 mars 2020 à 12:41
aucun résumé de modification
Ligne 1 : Ligne 1 :  
{{Python-Turtle-Online-NAV}}
 
{{Python-Turtle-Online-NAV}}
  −
{{traduction}}
      
== Démarrer Turtle ==
 
== Démarrer Turtle ==
Ligne 119 : Ligne 117 :     
[[Fichier:Python-Turtle-Exemple2-11c.png]]
 
[[Fichier:Python-Turtle-Exemple2-11c.png]]
 +
 +
== Remplissage ==
 +
Dans l'exemple suivant, {{fname|fillcolor()}}, {{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 917

modifications

Menu de navigation