Introduction
If you’re looking for a tutorial on how to draw a fish in Python Turtle, you’ve come to the correct spot. In this lesson, I’ll teach you how to design a fish in Python Turtle, so stick with me till the finish.
To draw fish in Python, we will use the turtle module. It is a Python GUI package that may be used to create characters, cartoons, shapes, and other things.
If you are unfamiliar with Python, drawing a fish might be challenging, but don’t worry, I will explain everything and supply you with the code for this application.
1. You only need to import the turtle library that comes with Python; no extra installation is required.
import turtle
2. The next step is to prepare a canvas on which to draw the fish. We can name the canvas variable whatever we want. For the time being, the screen’s name is vatsal. The code below generates and displays the screen for the user. We’ve also added some new properties, such as the color of the screen and the pen.
import turtle
vatsal = turtle
vatsal.color('black')
vatsal.Screen().bgcolor("#a2a2d0")
vatsal.pensize(10)
3. Let us now write a function that will draw the fish for us.
#Functions Which we will use
#goto(); function takes the pointer to a certain position.
#penup() and pendown() function controls when to draw and when to not draw
# forward() and backward() function needs the distance as a parameter
#left() and right() function needs an angle of turning as a parameter.
def Draw_Fish(i,j):
vatsal.penup()
vatsal.goto(i,j)
vatsal.speed(10)
vatsal.left(45)
vatsal.pendown()
vatsal.forward(100)
vatsal.right(135)
vatsal.forward(130)
vatsal.right(130)
vatsal.forward(90)
vatsal.left(90)
vatsal.right(90)
vatsal.circle(200,90)
vatsal.left(90)
vatsal.circle(200,90)
vatsal.penup()
vatsal.left(130)
vatsal.forward(200)
vatsal.pendown()
vatsal.circle(10,360)
vatsal.right(270)
vatsal.penup()
vatsal.forward(50)
vatsal.pendown()
vatsal.left(90)
vatsal.circle(100,45)
vatsal.penup()
vatsal.forward(300)
vatsal.left(135)
vatsal.pendown()
vatsal.right(180)
4. Let’s use the code below to draw three fish on the screen. And once we’ve finished drawing the fish, we’ll use the done() function to close the application screen.
Draw_Fish(0,0)
Draw_Fish(150,150)
Draw_Fish(150,-150)
vatsal.done()
Complete code to Draw a Fish Using Python Turtle
import turtle vatsal = turtle vatsal.color('black') vatsal.Screen().bgcolor("#a2a2d0") vatsal.pensize(10) def Draw_Fish(i,j): vatsal.penup() vatsal.goto(i,j) vatsal.speed(10) vatsal.left(45) vatsal.pendown() vatsal.forward(100) vatsal.right(135) vatsal.forward(130) vatsal.right(130) vatsal.forward(90) vatsal.left(90) vatsal.right(90) vatsal.circle(200,90) vatsal.left(90) vatsal.circle(200,90) vatsal.penup() vatsal.left(130) vatsal.forward(200) vatsal.pendown() vatsal.circle(10,360) vatsal.right(270) vatsal.penup() vatsal.forward(50) vatsal.pendown() vatsal.left(90) vatsal.circle(100,45) vatsal.penup() vatsal.forward(300) vatsal.left(135) vatsal.pendown() vatsal.right(180) Draw_Fish(0,0) Draw_Fish(150,150) Draw_Fish(150,-150) vatsal.done()
Output:
Congratulations! You now understand how to draw a fish on the screen in Python using the Turtle module.
If you want to see more amazing turtle tutorials like this one, go here: Python Turtle Codes.
If you don’t want to create all of the files and folders, you can run this program now with this online Python compiler, which is quick and easy.
Also Read:
- Falling Stars Animation on Python.Hub October 2024
- Most Underrated Database Trick | Life-Saving SQL Command
- Python List Methods
- Top 5 Free HTML Resume Templates in 2024 | With Source Code
- How to See Connected Wi-Fi Passwords in Windows?
- 2023 Merry Christmas using Python Turtle
- 23 AI Tools You Won’t Believe are Free
- Python 3.12.1 is Now Available
- Best Deepfake Apps and Websites You Can Try for Fun
- Amazon launched free Prompt Engineering course: Enroll Now
- 10 GitHub Repositories to Master Machine Learning
- Hello World in 35 Programming Languages
- How to Scrape Data From Any Website with Python?
- Become Job Ready With Free Harvard Computer Science course: Enroll Now
- Free Python Certification course from Alison: Good for Resume
- Download 1000+ Projects, All B.Tech & Programming Notes, Job, Resume & Interview Guide, and More – Get Your Ultimate Programming Bundle!
- Udacity Giving Free Python Course: Here is how to Enroll
- Love Babbar’s Income Revealed
- Top 5 Websites to Learn Programming in 2024
- Python Internship for college students and freshers: Apply Here
- Microsoft Giving Free Python Course in 2023: Enroll Now
- Top 5 Free Python Courses on YouTube in 2024
- Complete Python Roadmap for Beginners in 2024
- New secrets to Earn money with Python in 2024
- Connect with HR Directly – Job Hack
- Google offering free Python course: Enroll Today
- What is an AI Tool?
- Google Internship 2024
- TCS Launched Free Certification Course with Industry Recognized Value
- Top Free AI Tools for Students and Job Seekers