Hsslive.co.in: Kerala Higher Secondary News, Plus Two Notes, Plus One Notes, Plus two study material, Higher Secondary Question Paper.

Thursday, July 15, 2021

How to Draw a Doraemon Using Python Turtle, Tkinter, Matplotlib & Without Libraries

How to Draw a Doraemon in Python - There are various methods to create a Doraemon using python libraries like turtle, tkinter and matplotlib. Also, you will learn how to make a Doraemon using python in easy and simple steps. We have also provided the python code for drawing a Doraemon pattern. If you have introductory to intermediate knowledge in Python and statistics, then you can use this article as a one-stop shop for building and plotting Doraemon patterns in Python using libraries from its scientific stack, including NumPy, Matplotlib, Pandas, and Seaborn.


Plotting a Doraemon in python is a simple procedure, and python in its simplest provides multiple easy methods to do so.


How to Draw a Doraemon using Python?

Given below is the process to draw a Doraemon in python using libraries like Turtle, Tkinter, Matplotib and others.


Four Method to make a Doraemon in Python using multiple libraries:


  1. How to draw a Doraemon using python turtle?
  2. How to draw a Doraemon using python tkinter?
  3. How to draw a Doraemon using python matplotlib?
  4. How to draw a Doraemon using python code without library?

How to Draw a Doraemon using Python Turtle?

Check below step by step process to make a Doraemon using the python turtle library.

Step

  • Import the turtle module and start a function name “ankur” and give the parameters “x” and “y”. Then, call the penup() method and go to (x, y). And put the pen down.
  • Now, start a function name “aankha”. Inside this function, fill the part with the color white as in “#ffffff”. Now start the fill and set the tracer to False. Then, set the value of the variable “a” to 2.5. Likewise, start a for loop with the range of 120. Inside this loop, check if “i” which loops from 0 to 120 falls under (0 – 30) or (60 – 90). If yes, subtract 0.5 from “a” and call the methods lt() and fd() with the arguments “3” and “a”. If no, add 0.5 tp “a” and call the methods lt() and fd() as above. Now, end the fill.
  • Accordingly, start a function named “daari()” and call “ankur” with the arguments (-32, 135), the Seth method with the argument 165, and the fd() method with the argument 60. Likewise, do the same as above by changing the seth, fd, and the second argument of “ankur” as written in the code above.
  • Similarly, in the second part of our code to Draw Doraemon start a function mukh(). Inside this function, call the ankur() function with the arguments (5, 148). Likely, call the seth method with the argument “270” and fd() with “100”. Again, call the seth() method with 0 and draw a circle with the arguments “120, 100”. Then, call the seth(230) and circle(-120, 100).
  • Likewise, start a function muflar(). Inside this function, fill the part with the color #e70010. Then, begin the fill and call the seth(0) and fd(200) and draw a circle(-5, 90). Similarly, call the fd() method with the argument 207 and circle(-5, 90) . And again, fd(10) and circle (-5, 90).
  • Accordingly, start function name nak(). Inside this function, call the “ankur” function with the arguments (-10. 158) and seth(315). Then fill the part with the color #e70010 and begin the fill. As the nose is only one circle, draw a circle(20) and end the fill.
  • Likewise, start a function named black_aankha(). Inside this function, call the seth(0) and ankur with the arguments (-20, 195). Then, fill the part with the color #00000 ( black ) and begin the fill. Draw a circle(13) and end the first half. Now, set the pen size to 6 and call the “ankur” function with the arguments (20, 205), seth(75), circle(-10, 150), and set the pen size to 3. Again, call the “ankur” function with the arguments(-17, 200). Then, call seth(0), fill the part with #ffffff (white), and begin fill. Now, draw a circle(5) and end fill.
  • Similarly, create a function name face() . Inside this function, call the fd(183), lt(45), fill with the color #ffffff (white) and begin the fill. Now, create a circle(120, 100), seth(180), fd(121) and put the down. Then, call seth(215), circle(120, 100), end the fill and call “ankur” with the arguments (63.56, 213.24). Likewise, call seth(90), aankha(), seth(180) and pick the pen up. Then, call fd(60), pendown(), seth(90), aankha(), penup(), seth(180) and fd(64).
  • Now, create a function tauko(). Inside this function, call penup(), circle(150, 40), pendown() and fill the part with the color #00a0de. Then, begin the fill and draw a circle(150, 280) and end the fill.
  • In this part, of “Draw Doraemon with python turtle”, create a function name Doraemon(). Everything in this part is coded inside this function. First, call the taauko() function, muflar() function, face() function, nak() function, mukh() function, daari() function and ankur() function with the arguments (0, 0)
  • Now, call the seth(0),pick the pen up() and draw a circle(150, 50) and put the pen down. Likewise, call the seth() with the angle 30, fd(40), seth(70) and circle(-30, 270). Then, fill the part with the color #00a0de and begin the fill. Similarly, call the seth() with the value of angle 230, fd() with the value 80, seth with the angle 90, circle(1000, 1), again seth() with the angle -89 and circle(-1000, 10).
  • Accordingly, call the seth() with the angle 180, fd() with the value 70, seth with the angle 90, circle(30, 180), again seth() with the angle 180 and fd() with the value 70.
  • Then, call the seth with the angle 100 and circle(-1000, 9). Again, call the seth() method with the angle -86, circle(1000, 2), seth(230) and fd(40).
  • Likewise, draw a circle(-30, 230), seth() method with the angle 45, fd() method with the value 81, seth(0) and fd(203). Now, draw a circle(5, 90), fd(10), circle(5, 90), fd() method with the value 7, seth() method with the angle 40. Similarly, draw a circle(150, 10), seth(30), fd(40) and end the fill.
  • Now, call the seth(70) and fill the part with the color #ffffff (white) and begin the fill. Draw a circle with the value -3- and end the fill.
  • Similarly, call the ankur() function with the arguments (103.74, -182.59) and fill the part with the color #ffffff (white) and begin the fill. Now, call the fd(15), circle(-15, 180), fd(90), circle(-15, 180), fd(10) and end the fill.
  • Again, call the “ankur()” function with the arguments (-96.26, -182.59) and seth with the angle 180. Then, fill the part with color #ffffff (white) and begin the fill. Now, call the fd(15) and draw a circle(15, 180). Again call the fd(90), circle(15, 180) and fd(10) and end the fill.
  • Accordingly, call the “ankur()” function with the arguments (-133.97, -91.81), seth() method with the angle 50, fill the part with the color white and begin the fill of circle(30) and end the fill.
  • Now, again, call the “ankur” function with the arguments (-103.42, 15.09), seth() method with the angle 0, fd() with the value 38, again seth() with the angle 230 and begin the fill. Draw a circle(90, 260) and the fill.
  • Call the ankur() function (5, -40), seth() method with angle of 0, fd() with the value 70, seth with the angle of -90, circle(-70, 180), again seth with 0 and at lat fd with the value 70.
  • As this is the last code to Draw Doraemon with Python Turtle, call the “ankur()” function with the arguments (-103.42, 15.09), fd() with the value of 90, seth() method with the angle of 70. Fill the part with the color #ffd200 and begin the fill. Now, draw a circle(-20) and end the fill. Call the seth() method with the angle of 170 and full the part with the color #ffd200 and again begin the fill, Draw a circle(-2, 180), seth() method with the angle of 10. Now, draw 2 circles with the arguments (-100, 22) and (-1, 180) respectively. Then, call the seth() method with the angle of 90, circle(100, 22), and end the fill.
  • Go to (-13.42, 15.09) and call the method seth() with the angle of 250. Draw a circle of (20, 110), seth with the angle of 90, fd() with the value of 15, dot() method with the value of 10. At last, ankur() function with the arguments (0, -150) and the black_aankha() function.
  • Lastly, write the module source file code of the main program. i. e __name__ == “__main__” and set the screensize to (800, 600) and the background color to #f0f0f0. Set the pen size to 3 and set the speed to 9. Now, call the Doraemon() function and the ankur() function with the arguents (100, -300). Run the Tkinter event loop “mainloop()”.

Code

from turtle import *


# Doraemon with Python Turtle
def ankur(x, y):
penup()
goto(x, y)
pendown()


def aankha():
fillcolor("#ffffff")
begin_fill()

tracer(False)
a = 2.5
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a -= 0.05
lt(3)
fd(a)
else:
a += 0.05
lt(3)
fd(a)
tracer(True)
end_fill()


def daari():
ankur(-32, 135)
seth(165)
fd(60)

ankur(-32, 125)
seth(180)
fd(60)

ankur(-32, 115)
seth(193)
fd(60)

ankur(37, 135)
seth(15)
fd(60)

ankur(37, 125)
seth(0)
fd(60)

ankur(37, 115)
seth(-13)
fd(60)


def mukh():
ankur(5, 148)
seth(270)
fd(100)
seth(0)
circle(120, 50)
seth(230)
circle(-120, 100)


def muflar():
fillcolor('#e70010')
begin_fill()
seth(0)
fd(200)
circle(-5, 90)
fd(10)
circle(-5, 90)
fd(207)
circle(-5, 90)
fd(10)
circle(-5, 90)
end_fill()


def nak():
ankur(-10, 158)
seth(315)
fillcolor('#e70010')
begin_fill()
circle(20)
end_fill()


def black_aankha():
seth(0)
ankur(-20, 195)
fillcolor('#000000')
begin_fill()
circle(13)
end_fill()

pensize(6)
ankur(20, 205)
seth(75)
circle(-10, 150)
pensize(3)

ankur(-17, 200)
seth(0)
fillcolor('#ffffff')
begin_fill()
circle(5)
end_fill()
ankur(0, 0)


def face():
fd(183)
lt(45)
fillcolor('#ffffff')
begin_fill()
circle(120, 100)
seth(180)
# print(pos())
fd(121)
pendown()
seth(215)
circle(120, 100)
end_fill()
ankur(63.56, 218.24)
seth(90)
aankha()
seth(180)
penup()
fd(60)
pendown()
seth(90)
aankha()
penup()
seth(180)
fd(64)


def taauko():
penup()
circle(150, 40)
pendown()
fillcolor('#00a0de')
begin_fill()
circle(150, 280)
end_fill()


def Doraemon():
taauko()

muflar()

face()

nak()

mukh()

daari()

ankur(0, 0)

seth(0)
penup()
circle(150, 50)
pendown()
seth(30)
fd(40)
seth(70)
circle(-30, 270)

fillcolor('#00a0de')
begin_fill()

seth(230)
fd(80)
seth(90)
circle(1000, 1)
seth(-89)
circle(-1000, 10)

# print(pos())

seth(180)
fd(70)
seth(90)
circle(30, 180)
seth(180)
fd(70)

# print(pos())
seth(100)
circle(-1000, 9)

seth(-86)
circle(1000, 2)
seth(230)
fd(40)

# print(pos())

circle(-30, 230)
seth(45)
fd(81)
seth(0)
fd(203)
circle(5, 90)
fd(10)
circle(5, 90)
fd(7)
seth(40)
circle(150, 10)
seth(30)
fd(40)
end_fill()

seth(70)
fillcolor('#ffffff')
begin_fill()
circle(-30)
end_fill()

ankur(103.74, -182.59)
seth(0)
fillcolor('#ffffff')
begin_fill()
fd(15)
circle(-15, 180)
fd(90)
circle(-15, 180)
fd(10)
end_fill()

ankur(-96.26, -182.59)
seth(180)
fillcolor('#ffffff')
begin_fill()
fd(15)
circle(15, 180)
fd(90)
circle(15, 180)
fd(10)
end_fill()

ankur(-133.97, -91.81)
seth(50)
fillcolor('#ffffff')
begin_fill()
circle(30)
end_fill()
# Doraemon with Python Turtle

ankur(-103.42, 15.09)
seth(0)
fd(38)
seth(230)
begin_fill()
circle(90, 260)
end_fill()

ankur(5, -40)
seth(0)
fd(70)
seth(-90)
circle(-70, 180)
seth(0)
fd(70)

ankur(-103.42, 15.09)
fd(90)
seth(70)
fillcolor('#ffd200')
# print(pos())
begin_fill()
circle(-20)
end_fill()
seth(170)
fillcolor('#ffd200')
begin_fill()
circle(-2, 180)
seth(10)
circle(-100, 22)
circle(-2, 180)
seth(180 - 10)
circle(100, 22)
end_fill()
goto(-13.42, 15.09)
seth(250)
circle(20, 110)
seth(90)
fd(15)
dot(10)
ankur(0, -150)

black_aankha()


if __name__ == '__main__':
screensize(800, 600, "#f0f0f0")
pensize(3)
speed(9)
Doraemon()
ankur(100, -300)
write('by Ankur Gajurel', font=("Bradley Hand ITC", 30, "bold"))
mainloop()

Output

How to Draw a Doraemon Using Python Turtle, Tkinter, Matplotlib & Without Libraries
How to Draw a Doraemon Using Python Turtle, Tkinter, Matplotlib & Without Libraries


How to Draw a Doraemon using Python Tkinter?

Check below step by step process to make a Doraemon using the python tkinter library.


Step

Code

Output

How to Draw a Doraemon using Python Matplotlib?

Check below step by step process to make a Doraemon using the python matplotlib library.


Step

Code

Output

How to Draw a Doraemon using Python Code without Library?

Step

Code

Output


Note: Also, these codes might not run in an online compiler please use an offline compiler. Programmers can make any changes in the code according to their specific requirement.


Conclusion on How to Draw a Doraemon using Python

We hope the programs and methods provided above on how to make a Doraemon using python libraries have been helpful to you. If there is any issue in any of the code please let us know in the comments. We will try to resolve it as soon as possible.

Other Patterns you can Draw using Python

Share:

0 comments:

Post a Comment

Plus One (+1) Previous Year Question Papers

Plus One (+1) Previous Year Chapter Wise Question Papers, Plus One (+1) Physics Previous Year Chapter Wise Question Papers , Plus One (+1) Chemistry Previous Year Chapter Wise Question Papers, Plus One (+1) Maths Previous Year Chapter Wise Question Papers, Plus One (+1) Zoology Previous Year Chapter Wise Question Papers , Plus One (+1) Botany Previous Year Chapter Wise Question Papers, Plus One (+1) Computer Science Previous Year Chapter Wise Question Papers, Plus One (+1) Computer Application Previous Year Chapter Wise Question Papers, Plus One (+1) Commerce Previous Year Chapter Wise Question Papers , Plus One (+1) Humanities Previous Year Chapter Wise Question Papers , Plus One (+1) Economics Previous Year Chapter Wise Question Papers , Plus One (+1) History Previous Year Chapter Wise Question Papers , Plus One (+1) Islamic History Previous Year Chapter Wise Question Papers, Plus One (+1) Psychology Previous Year Chapter Wise Question Papers , Plus One (+1) Sociology Previous Year Chapter Wise Question Papers , Plus One (+1) Political Science Previous Year Chapter Wise Question Papers, Plus One (+1) Geography Previous Year Chapter Wise Question Papers , Plus One (+1) Accountancy Previous Year Chapter Wise Question Papers, Plus One (+1) Business Studies Previous Year Chapter Wise Question Papers, Plus One (+1) English Previous Year Chapter Wise Question Papers , Plus One (+1) Hindi Previous Year Chapter Wise Question Papers, Plus One (+1) Arabic Previous Year Chapter Wise Question Papers, Plus One (+1) Kaithang Previous Year Chapter Wise Question Papers , Plus One (+1) Malayalam Previous Year Chapter Wise Question Papers

Plus Two (+2) Previous Year Question Papers

Plus Two (+2) Previous Year Chapter Wise Question Papers, Plus Two (+2) Physics Previous Year Chapter Wise Question Papers , Plus Two (+2) Chemistry Previous Year Chapter Wise Question Papers, Plus Two (+2) Maths Previous Year Chapter Wise Question Papers, Plus Two (+2) Zoology Previous Year Chapter Wise Question Papers, Plus Two (+2) Botany Previous Year Chapter Wise Question Papers, Plus Two (+2) Computer Science Previous Year Chapter Wise Question Papers, Plus Two (+2) Computer Application Previous Year Chapter Wise Question Papers, Plus Two (+2) Commerce Previous Year Chapter Wise Question Papers , Plus Two (+2) Humanities Previous Year Chapter Wise Question Papers , Plus Two (+2) Economics Previous Year Chapter Wise Question Papers , Plus Two (+2) History Previous Year Chapter Wise Question Papers , Plus Two (+2) Islamic History Previous Year Chapter Wise Question Papers, Plus Two (+2) Psychology Previous Year Chapter Wise Question Papers , Plus Two (+2) Sociology Previous Year Chapter Wise Question Papers , Plus Two (+2) Political Science Previous Year Chapter Wise Question Papers, Plus Two (+2) Geography Previous Year Chapter Wise Question Papers, Plus Two (+2) Accountancy Previous Year Chapter Wise Question Papers, Plus Two (+2) Business Studies Previous Year Chapter Wise Question Papers, Plus Two (+2) English Previous Year Chapter Wise Question Papers , Plus Two (+2) Hindi Previous Year Chapter Wise Question Papers, Plus Two (+2) Arabic Previous Year Chapter Wise Question Papers, Plus Two (+2) Kaithang Previous Year Chapter Wise Question Papers , Plus Two (+2) Malayalam Previous Year Chapter Wise Question Papers
Copyright © Hsslive