Forma-1-es autót rajzol ki a python program
--------------
import turtle
screen = turtle.Screen()
screen.setup(width=900, height=800)
screen.bgcolor("white")
screen.title("Ferrari sportkocsi")
t = turtle.Turtle()
t.speed(0)
t.pensize(3)
def poly(points, fill, outline="black"):
t.color(outline, fill)
t.penup()
t.goto(points[0])
t.pendown()
t.begin_fill()
for p in points[1:]:
t.goto(p)
t.goto(points[0])
t.end_fill()
def wheel(x, y, r=42):
t.penup()
t.goto(x, y - r)
t.pendown()
t.color("black", "black")
t.begin_fill()
t.circle(r)
t.end_fill()
t.penup()
t.goto(x, y - r * 0.45)
t.pendown()
t.color("gray", "gray")
t.begin_fill()
t.circle(r * 0.45)
t.end_fill()
def car_body():
poly([(-360, -70), (-300, -35), (-220, -15), (120, -15), (240, -35), (320, -70), (300, -95), (-340, -95)], "red")
poly([(-175, -15), (-115, 40), (15, 55), (110, 45), (165, -15)], "red")
poly([(-150, -10), (-100, 30), (10, 40), (90, 32), (135, -10)], "lightblue")
poly([(160, -15), (235, -35), (255, -70), (185, -50)], "darkred")
poly([(-335, -70), (-260, -70), (-255, -95), (-345, -95)], "black")
poly([(-350, -95), (-290, -95), (-300, -110), (-360, -110)], "darkred")
poly([(-360, -55), (-305, -55), (-295, -65), (-350, -65)], "black")
poly([(-365, -68), (-325, -68), (-325, -82), (-365, -82)], "black")
poly([(300, -68), (350, -60), (345, -80), (295, -85)], "black")
t.penup()
t.goto(0, 35)
t.pendown()
t.color("black")
t.pensize(8)
t.setheading(0)
t.circle(20, 180)
t.pensize(3)
wheel(-210, -95, 46)
wheel(185, -95, 46)
car_body()
t.hideturtle()
turtle.done()
-----------
Nincsenek megjegyzések:
Megjegyzés küldése