Hướng dẫn how to draw a horse in python - làm thế nào để vẽ một con ngựa trong trăn

Điều kiện tiên quyết: Lập trình rùa trong PythonTurtle Programming in Python

Rùa Rùa là một tính năng Python giống như một bảng vẽ, cho phép chúng tôi ra lệnh cho một con rùa vẽ khắp nơi! Rùa rùa đi kèm với gói Python tiêu chuẩn và không cần phải cài đặt bên ngoài.

Bước 1: Nhập rùa và mô -đun toán học trong Python.Import turtle and math module in Python.

import turtle
import math

Bước 2: Chọn màu nền cho màn hình đầu ra của bạn. Bạn có thể chọn bất kỳ màu nào, chúng tôi sẽ sử dụng màu vàng chỉ để làm cho nó hấp dẫn.Choose a background color for your output screen. You can choose any color, we will use yellow color just to make it attractive.

screen = turtle.Screen()
screen.bgcolor("yellow")

Bước 3: Chọn màu và tốc độ của rùa (bút), người sẽ vẽ ngôi nhà trên màn hình. Choose the color and speed of your turtle(pen) who will draw the house on the screen.

t.color("black")
t.shape("turtle")
t.speed(1)

Bước 4: Bây giờ, chúng ta cần vẽ căn cứ của ngôi nhà của bạn và vì điều đó, bạn cần vẽ một hình chữ nhật. Now, we need to draw the base of your house and for that, you need to draw a rectangle.

Bạn có thể điền vào bất kỳ màu nào trong sự lựa chọn của bạn chỉ bằng cách thay đổi tên màu trong lệnh t.fillcolor (‘). & Nbsp;

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()

Cơ sở của ngôi nhà sẽ trông này:

https://media.geeksforgeeks.org/wp-content/uploads/20200913124224/Rectangle.mp4

Bước 5: Bây giờ bạn đã tạo cơ sở, bước tiếp theo là tạo ra đỉnh của ngôi nhà. Vẽ một tam giác cho phần trên, chỉ để giữ cho nó đơn giản. Now you created the base, the next step is to create the top of the house. Draw a triangle for the upper portion, just to keep it simple.

# for creating triangle
# i.e top of the house
t.fillcolor('brown')
t.begin_fill()
t.right(45)
t.forward(200)
t.right(90)
t.forward(200)
t.left(180)
t.forward(200)
t.right(135)
t.forward(259)
t.right(90)
t.forward(142)
t.end_fill()

Bước 6: Chúng ta phải bảo đảm ngôi nhà của mình bằng cách đặt cửa và cả cửa sổ để thông gió. Đây là mã cho điều đó- We must secure our house by Putting the Door and also windows for ventilation. Here is the code for that-

# for windows and
# for creating door
t.right(90)
t.forward(400)
t.left(90)
t.forward(50)
t.left(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(180)
t.forward(200)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)

t.right(90)
t.forward(100)
t.right(90)
t.forward(150)
t.right(90)
t.forward(100)
t.right(90)
t.forward(75)
t.right(90)
t.forward(200)

Mã hoàn chỉnh:

Python3

import turtle

t =

screen = turtle.Screen()
screen.bgcolor("yellow")
0

screen = turtle.Screen()
screen.bgcolor("yellow")
1=
screen = turtle.Screen()
screen.bgcolor("yellow")
3

screen = turtle.Screen()
screen.bgcolor("yellow")
4
screen = turtle.Screen()
screen.bgcolor("yellow")
5
screen = turtle.Screen()
screen.bgcolor("yellow")
6

screen = turtle.Screen()
screen.bgcolor("yellow")
7
screen = turtle.Screen()
screen.bgcolor("yellow")
8
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.color("black")
t.shape("turtle")
t.speed(1)
0
t.color("black")
t.shape("turtle")
t.speed(1)
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.color("black")
t.shape("turtle")
t.speed(1)
3
t.color("black")
t.shape("turtle")
t.speed(1)
4
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.color("black")
t.shape("turtle")
t.speed(1)
6
t.color("black")
t.shape("turtle")
t.speed(1)
7
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.color("black")
t.shape("turtle")
t.speed(1)
9

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
4
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
6
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
# for creating triangle
# i.e top of the house
t.fillcolor('brown')
t.begin_fill()
t.right(45)
t.forward(200)
t.right(90)
t.forward(200)
t.left(180)
t.forward(200)
t.right(135)
t.forward(259)
t.right(90)
t.forward(142)
t.end_fill()

0
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
6
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
4
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
6
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
# for creating triangle
# i.e top of the house
t.fillcolor('brown')
t.begin_fill()
t.right(45)
t.forward(200)
t.right(90)
t.forward(200)
t.left(180)
t.forward(200)
t.right(135)
t.forward(259)
t.right(90)
t.forward(142)
t.end_fill()

0
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

# for windows and
# for creating door
t.right(90)
t.forward(400)
t.left(90)
t.forward(50)
t.left(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(180)
t.forward(200)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)

t.right(90)
t.forward(100)
t.right(90)
t.forward(150)
t.right(90)
t.forward(100)
t.right(90)
t.forward(75)
t.right(90)
t.forward(200)

7

t.color("black")
t.shape("turtle")
t.speed(1)
6
# for windows and
# for creating door
t.right(90)
t.forward(400)
t.left(90)
t.forward(50)
t.left(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(180)
t.forward(200)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)

t.right(90)
t.forward(100)
t.right(90)
t.forward(150)
t.right(90)
t.forward(100)
t.right(90)
t.forward(75)
t.right(90)
t.forward(200)

9
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.color("black")
t.shape("turtle")
t.speed(1)
9

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0import3
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
6turtle5
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0t 1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3t 4
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3=0
screen = turtle.Screen()
screen.bgcolor("yellow")
6

# for windows and
# for creating door
t.right(90)
t.forward(400)
t.left(90)
t.forward(50)
t.left(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(180)
t.forward(200)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)

t.right(90)
t.forward(100)
t.right(90)
t.forward(150)
t.right(90)
t.forward(100)
t.right(90)
t.forward(75)
t.right(90)
t.forward(200)

7

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
# for creating triangle
# i.e top of the house
t.fillcolor('brown')
t.begin_fill()
t.right(45)
t.forward(200)
t.right(90)
t.forward(200)
t.left(180)
t.forward(200)
t.right(135)
t.forward(259)
t.right(90)
t.forward(142)
t.end_fill()

0
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
6
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
03
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
6
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
09
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0turtle5
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
09
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
09
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
51
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
09
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
51
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
69
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0turtle5
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
69
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
6
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
93
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
6
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3import6
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
93
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
0
t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
1
screen = turtle.Screen()
screen.bgcolor("yellow")
6

t.fillcolor('cyan')
t.begin_fill( )
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)

t.forward(250)

t.left(90)
t.forward(400)
t.right(90)
t.end_fill()
3
screen = turtle.Screen()
screen.bgcolor("yellow")
69
screen = turtle.Screen()
screen.bgcolor("yellow")
6

Output:

https://media.geeksforgeeks.org/wp-content/uploads/20200913125802/House.mp4


Tôi có thể vẽ trong Python không?

Chúng ta có thể vẽ các hình dạng khác nhau và lấp đầy các màu khác nhau bằng các phương pháp rùa. Có rất nhiều chức năng và chương trình được mã hóa bằng thư viện rùa trong Python.. There's plethora of functions and programs to be coded using the turtle library in python.

Python có thể vẽ hình dạng?

Rùa là một tính năng Python giống như một bảng vẽ, chúng ta cho chúng ta chỉ huy một con rùa để vẽ khắp nơi!Chúng ta có thể sử dụng nhiều chức năng rùa có thể di chuyển con rùa xung quanh.

Làm thế nào để bạn vẽ đồ họa trong Python?

từ nhập đồ họa * win = graphwin ().
pt = điểm (100, 50).
pt.Vẽ (thắng).
cir = vòng tròn (pt, 25) Cir.Vẽ (thắng).
Cir.SetOutline ('Red') Cir.setfill ('màu xanh').
dòng = dòng (pt, điểm (150, 100)) dòng.Vẽ (thắng).
orth = hình chữ nhật (điểm (20, 10), pt) trực tràng.Vẽ (thắng).
hàng.di chuyển (10, 40).

Làm thế nào để bạn vẽ một con chó trong Python?

Vẽ một con chó bằng rùa Python..
Hàm nhập.Nhập Rùa.....
Đặt đối tượng rùa.....
Vẽ mặt của con chó.....
Vẽ lưỡi của con chó.....
Vẽ đường trên lưỡi của con chó.....
Vẽ tai phải của khuôn mặt con chó.....
Vẽ tai trái của con chó.....
Vẽ đôi mắt đen bên phải và trái của con chó ..