Thư viện rùa Python cung cấp tất cả các công cụ và phương pháp để vẽ bất kỳ hình dạng, hình ảnh hoặc thiết kế nào với các lệnh khác nhau. Trong bài viết này, chúng tôi sẽ vẽ bảng chữ cái với Thư viện Rùa Python. Trước khi tiến hành, bạn phải đọc phần giới thiệu về lập trình rùa.Draw alphabets with python turtle library. Before proceeding you must read the introduction to turtle programming.
Vẽ thư A với rùa Python:
Chúng ta có thể sử dụng các chức năng tích hợp rùa rùa như rùa.forward (), rùa.right (), rùa.left () hoặc rùa.goto (), v.v. để vẽ bất kỳ hình dạng nào.
import turtle t=turtle.Turtle() t.penup() t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(65) t.forward(100) t.setpos(-30,50) t.right(50) t.forward(100) t.penup() t.setpos(-50,-10) t.right(65) t.pendown() t.backward(50)
Vẽ thư B với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180)
Vẽ thư C với rùa Python:
#.....draw letter C with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(180) t.circle(50,180)
Vẽ thư D với rùa Python:
#.....draw letter D with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw curves t.pendown() t.right(-90) t.circle(-100,180)
Vẽ thư E với rùa Python:
#.....draw letter E with python turtle........! import turtle t=turtle.Turtle() t.penup() t.setpos(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.forward(100) t.backward(100) t.right(90) t.forward(100) t.left(90) t.forward(100) t.backward(100) t.right(90) t.forward(100) t.left(90) t.forward(100)
Vẽ thư F với rùa Python:
#.....draw letter F with python turtle........! import turtle t=turtle.Turtle() t.penup() t.setpos(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.forward(100) t.backward(100) t.right(90) t.forward(100) t.left(90) t.forward(100) t.backward(100) t.right(90) t.forward(100)
Vẽ thư G với rùa Python:
#.....draw letter G with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(180) t.circle(50,180) t.left(90) t.forward(50) t.goto(-50,0) t.right(90) t.forward(50) t.right(90) t.forward(20)
Vẽ thư H với rùa Python:
#.....draw letter H with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.goto(-30,-50) t.goto(50,-50) t.goto(50,50) t.goto(50,-140)
Vẽ thư I với rùa Python:
#.....draw letter I with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(100)
Vẽ thư j với rùa python:
#.....draw letter J with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.forward(10) t.right(90) t.forward(150) t.circle(-50,180)
Vẽ thư K với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 0
Vẽ thư L với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 1
Vẽ thư m với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 2
Vẽ thư n với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 3
Vẽ thư o với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 4
Vẽ thư P với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 5
Vẽ thư q với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 6
Vẽ thư r với rùa python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 7
Vẽ thư s với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 7
Vẽ thư T với rùa Python:
#.....draw letter B with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(90) t.forward(200) t.penup() t.goto(-30,50) #centering in the screen #draw first curve t.pendown() t.right(-90) t.circle(-50,180) t.penup() t.goto(-30,-50) #centering in the screen #draw second curve t.pendown() t.right(180) t.circle(-50,180) 9
Vẽ thư u với rùa python:
#.....draw letter C with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(180) t.circle(50,180) 0
Vẽ thư v với rùa Python:
#.....draw letter C with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(180) t.circle(50,180) 1
Vẽ thư w với rùa Python:
#.....draw letter C with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(180) t.circle(50,180) 2
Vẽ thư X với rùa Python:
#.....draw letter C with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(180) t.circle(50,180) 3
Vẽ thư y với rùa python:
#.....draw letter C with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(180) t.circle(50,180) 4
Vẽ thư Z với rùa Python:
#.....draw letter C with python turtle........! import turtle t=turtle.Turtle() t.penup() #draw straight line t.goto(-30,50) #centering in the screen t.pendown() t.pensize(10) t.pencolor("red") t.right(180) t.circle(50,180) 5