Posts

Showing posts from June, 2021

Draw Circle spirograph using turtle graphics

Image
 The best advantage of turtle graphics in python is you can be creativity as much as you want. You can make a lot of creative designs and arts using it. In this article I'll share the source code to draw a beautiful Circle spirograph in your Mobile phone.    Source Code:-  import turtle turtle.bgcolor("black") turtle.pensize(2) turtle.speed(0) for i in range(25):     for colours in ("red", "magenta", "blue", "cyan", "green", "yellow", "white"):         turtle.color(colours)         turtle.circle(100)         turtle.left(10)         turtle.hideturtle() turtle.penup()  turtle.setposition(-200, -300)  turtle.pendown()  turtle.write(" follow@only.python")  turtle.done()  Output :- If you like this article share it with your friends and follow me on Instagram @only.python.

Drawing Pikachu using Python turtle graphics.

Image
  Hey guys welcome once again to the blog page of @only.python. In this article I'll share the source code and video of Drawing Pikachu (a famous cartoon character) using Python turtle graphics.  Source code:-   import turtle def getPosition(x, y):         turtle.setx(x)         turtle.sety(y)         print(x, y) class Pikachu:     def __init__(self):         self.t = turtle.Turtle()         t = self.t         t.pensize(3)         t.speed(9)         t.ondrag(getPosition)                   def noTrace_goto(self, x, y):         self.t.penup()         self.t.goto(x, y)         self.t.pendown()     def leftEye(self, x, y):         self.noTrace_goto(x, y)         t = self.t         t.seth(0)         t.fillcolor('#333333')         t.begin_fill()         t.circle(22)         t.end_fill()         self.noTrace_goto(x, y+10)         t.fillcolor('#000000')         t.begin_fill()         t.circle(10)         t.end_fill()         self.noTrace_goto(x+6, y + 22)         t.fillcolo

Draw Shinchan using Turtle graphics in your Mobile phone 😱

Image
 Hello guys and welcome to blog page of @only.python. Hope that you all are doing great and safe. Today I'll share how to draw Shinchan, a famous cartoon character using python turtle graphics in your smartphone, yeah you read it right in your smartphone. We'll see how to draw shinchan here step by step. And don't forget to follow me on Instagram for amazing stuff related to python only.  Step 1:- First, import everything from the turtle module. Then, set a turtle screen into a variable “s”. Set the screen size to (700, 1000) and the speed to 5. Step 2:-  Define a function myPosition() with the parameters “x, y”. Here, pick the pen up as we are not ready to draw. Go to the position as in (x, y). Put the pen down. Set the pen size to 2. Step 3:- Define a function named saurabh() for the shorts of our drawing. Here, set the fill color as ‘#ffec40’. Begin the fill. Now, move the turtle right at 25 units, forward at 20, right at 45, and again forward at 20 units. Move the turtl

Hedgehog space using python turtle graphics

Image
 Hello friends, In this article I'll share the Source code to draw a hedgehog space using turtle graphics in python.  Source Code :- #@only.python import turtle  ninja = turtle.Turtle() ninja.speed(10) for i in range(180):     ninja.forward(100)     ninja.right(30)     ninja.forward(20)     ninja.left(60)     ninja.forward(50)     ninja.right(30)          ninja.penup()     ninja.setposition(0, 0)     ninja.pendown()          ninja.right(2)   ninja.penup() ninja.setposition(-200,-300) ninja.pendown() ninja.pencolor("red") ninja.write("Follow @only.python")      turtle.done() Output :-    Tap here to see output For more codes follow @only.python on Instagram

Rainbow benzene using Python turtle Graphics

Image
Hello friends, Source code to draw a Rainbow benzene using Python turtle Graphics is given below -  Rainbow Benzene Source Code:- # @only.python import turtle  colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow']  t = turtle.Pen()  turtle.bgcolor('black')  for x in range(360):      t.pencolor(colors[x%6])      t.width(x/100 + 1)      t.forward(x)      t.left(59) OUTPUT:-    Tap here to see output For more codes follow @only.python on Instagram