Cool Python Turtle Graphics | Drawing Simple shapes :

Cool Python Turtle Graphics | Drawing Simple shapes :

Share It With Your Firends:

turtle is a pre-installed Python library that enables users to create pictures and shapes by providing them with a virtual canvas. The onscreen pen that you use for drawing is called the turtle and this is what gives the library its name.

import turtle

pen = turtle.Turtle()


def ring(col, rad):
    pen.fillcolor(col)
    pen.begin_fill()

    pen.circle(rad)
    pen.end_fill()


pen.up()
pen.setpos(-35, 95)
pen.down()
ring('black', 15)

# Draw second ear
pen.up()
pen.setpos(35, 95)
pen.down()
ring('black', 15)

pen.up()
pen.setpos(0, 35)
pen.down()
ring('white', 40)

# Draw first eye
pen.up()
pen.setpos(-18, 75)
pen.down()
ring('black', 8)

pen.up()
pen.setpos(18, 75)
pen.down()
ring('black', 8)

pen.up()
pen.setpos(-18, 77)
pen.down()
ring('white', 4)

pen.up()
pen.setpos(18, 77)
pen.down()
ring('white', 4)

pen.up()
pen.setpos(0, 55)
pen.down()
ring('black', 5)

pen.up()
pen.setpos(0, 55)
pen.down()
pen.right(90)
pen.circle(5, 180)
pen.up()
pen.setpos(0, 55)
pen.down()
pen.left(360)
pen.circle(5, -180)
pen.hideturtle()

turtle.done()

Share It With Your Friends

1 Comment

Leave a Reply

Recent Posts

  • All Post
  • A.I.
  • AI
  • c
  • c++
  • computer
  • cryptocurrency
  • database
  • digital marketing
  • finance
  • hacking
  • HTML
  • java
  • Marketing
  • network
  • other
  • programming
  • python
  • react
  • social
  • Tools
  • Uncategorized
  • web devlopment
    •   Back
    • drawing In Python
DIY AI Voice Assistant In Python

September 8, 2023

Build your own AI assistant with Python! Learn to recognize voice commands, generate responses, and more. Create your virtual companion…

share it

Recent Posts

  • All Post
  • A.I.
  • AI
  • c
  • c++
  • computer
  • cryptocurrency
  • database
  • digital marketing
  • finance
  • hacking
  • HTML
  • java
  • Marketing
  • network
  • other
  • programming
  • python
  • react
  • social
  • Tools
  • Uncategorized
  • web devlopment
    •   Back
    • drawing In Python

Additional Content

CodeWithAM

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus luctus.

Products

Automated Chatbot

Data Security

Virtual Reality

Communication

Support

Services

FAQ's

Privacy Policy

Terms & Condition

Team

Contact Us

Company

About Us

Services

Features

Our Pricing

Latest News

© 2023 Codewitham