| Ligne 5 : |
Ligne 5 : |
| | Cela permet de se faire une petite idée des possibilités offertes par Turtle. | | Cela permet de se faire une petite idée des possibilités offertes par Turtle. |
| | | | |
| − | == --- Faire un carré (et apprendre l'anglais) | + | == Faire un carré == |
| | + | |
| | + | <syntaxhighlight lang="python"> |
| | import turtle | | import turtle |
| | | | |
| Ligne 23 : |
Ligne 25 : |
| | t.forward( 100 ) # Avancer 100 points | | t.forward( 100 ) # Avancer 100 points |
| | t.right( 90 ) # Tourner droite 90 degrés | | t.right( 90 ) # Tourner droite 90 degrés |
| | + | </syntaxhighlight> |
| | | | |
| − | --- Faire un carré (et utiliser les mots cours)
| + | == Faire un carré : syntaxe abrégée == |
| | | | |
| | + | <syntaxhighlight lang="python"> |
| | import turtle | | import turtle |
| | | | |
| Ligne 43 : |
Ligne 47 : |
| | t.fd( 100 ) # Avancer 100 points | | t.fd( 100 ) # Avancer 100 points |
| | t.rt( 90 ) # Tourner droite 90 degrés | | t.rt( 90 ) # Tourner droite 90 degrés |
| | + | </syntaxhighlight> |
| | | | |
| | | | |
| − | --- Faire un carré avec plusieurs couleurs
| + | == faire un carré : avec plusieurs couleurs == |
| | | | |
| | + | <syntaxhighlight lang="python"> |
| | import turtle | | import turtle |
| | | | |
| Ligne 55 : |
Ligne 61 : |
| | t.forward(75) | | t.forward(75) |
| | t.left(90) | | t.left(90) |
| | + | </syntaxhighlight> |
| | | | |
| − | --- Faire un carré avec une fonction
| + | == Faire un carré : avec une fonction == |
| | | | |
| | + | <syntaxhighlight lang="python"> |
| | import turtle | | import turtle |
| | | | |
| Ligne 69 : |
Ligne 77 : |
| | t.clear() | | t.clear() |
| | faire_carre() | | faire_carre() |
| | + | </syntaxhighlight> |
| | | | |
| − | --- SpiroGraphe simple (fleur)
| + | == SpiroGraphe simple == |
| | | | |
| | + | <syntaxhighlight lang="python"> |
| | import turtle | | import turtle |
| | | | |
| Ligne 89 : |
Ligne 99 : |
| | t.clear() | | t.clear() |
| | faire_fleur() | | faire_fleur() |
| | + | </syntaxhighlight> |
| | | | |
| − | --- Rose --
| + | == Dessiner une Rose == |
| | | | |
| | + | <syntaxhighlight lang="python"> |
| | from turtle import * | | from turtle import * |
| | color('red', 'yellow') | | color('red', 'yellow') |
| Ligne 104 : |
Ligne 116 : |
| | end_fill() | | end_fill() |
| | done() | | done() |
| | + | </syntaxhighlight> |
| | | | |
| | {{Python-Turtle-Online-TRAILER}} | | {{Python-Turtle-Online-TRAILER}} |