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:
- Case conversion in python assignment expert
- Complete Python Roadmap for Beginners in 2022
- Calculator Program in Python | On Different IDEs
- Boruvka’s Algorithm in Python
- Game in Python Assignment Expert
- Guessing number in python assignment expert
- Make it equal in Python assignment expert
- New Internship for Python Freshers | Apply Now
- Naive Bayes in Machine Learning
- Roti Prata SPOJ Problem Solution – Complete Solution Approach with C++ and Java Code
- Lee Algorithm in Python | Solution to Maze Routing Problem in Python
- Free Python Course | Loved By Over 7.7 Million People
- Top 10 Python Projects for Final year Students
- 10 Tkinter Projects for Beginners
- Miles Per Gallon Python Program
- Get a New Job with Google: Course by Google
- Top 5 Websites To Learn Programming in 2022
- FAQs
- Automate Data Mining With Python
- ASCII Art in Python with art library
- Create and Print a List of Prime Numbers in Python
- Support Vector Machine(SVM) in Machine Learning
- Python Increment By 1
- Vending Machine with Python Code
- I Love You Text in ASCII Art
- Top 5 Youtube Channels to Learn Programming in 2022
- Python Turtle Shapes- Square, Rectangle, Circle
- Python OOP Projects | Source code and example
- Internship at Google: Apply Now | Google STEP Internship
- Python Turtle Commands and All Methods