Doraemon Graphic Design with Python
This is our Doraemon graphics project in python program from Tkinter library. It is made from turtle module library which is inbuilt module in our python IDE plateforms and mainly focus the intermediate coders in python turtle.So, firstly install this library module and make it this project to write the program only five parts of coding ways are as given belows:-
- 1st part:- ( 3 Body Parts inside functions )
- 2nd part :- ( Another 3 Body Parts )
- 3rd part :- ( Last three Body Parts )
- 4th part :- (Doraemon whole body function)
- 5th part :- (Module Source File)
Demo Video
# Doraemon 2d graphics Source Code in python
from turtle import *
# Doraemon with Python Turtle
def ankure(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():
ankure(-32, 135)
seth(165)
fd(60)
ankure(-32, 125)
seth(180)
fd(60)
ankure(-32, 115)
seth(193)
fd(60)
ankure(37, 135)
seth(15)
fd(60)
ankure(37, 125)
seth(0)
fd(60)
ankure(37, 115)
seth(-13)
fd(60)
def mukh():
ankure(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():
ankure(-10, 158)
seth(315)
fillcolor('#e70010')
begin_fill()
circle(20)
end_fill()
def black_aankha():
seth(0)
ankure(-20, 195)
fillcolor('#000000')
begin_fill()
circle(13)
end_fill()
pensize(6)
ankure(20, 205)
seth(75)
circle(-10, 150)
pensize(3)
ankure(-17, 200)
seth(0)
fillcolor('#ffffff')
begin_fill()
circle(5)
end_fill()
ankure(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()
ankure(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()
ankure(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()
ankure(103.74, -182.59)
seth(0)
fillcolor('#ffffff')
begin_fill()
fd(15)
circle(-15, 180)
fd(90)
circle(-15, 180)
fd(10)
end_fill()
ankure(-96.26, -182.59)
seth(180)
fillcolor('#ffffff')
begin_fill()
fd(15)
circle(15, 180)
fd(90)
circle(15, 180)
fd(10)
end_fill()
ankure(-133.97, -91.81)
seth(50)
fillcolor('#ffffff')
begin_fill()
circle(30)
end_fill()
# Doraemon with Python Turtle
ankure(-103.42, 15.09)
seth(0)
fd(38)
seth(230)
begin_fill()
circle(90, 260)
end_fill()
ankure(5, -40)
seth(0)
fd(70)
seth(-90)
circle(-70, 180)
seth(0)
fd(70)
ankure(-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)
ankure(0, -150)
black_aankha()
if __name__ == '__main__':
screensize(800, 600, "#f0f0f0")
pensize(3)
speed(9)
Doraemon()
ankure(100, -300)
write('by Ashwin Verma', font=("Bradley Hand ITC", 30, "bold"))
mainloop()
1st part:- ( 3 Body Parts inside functions ) :
- In the 1st part of our code to Draw the 2d Doraemon, import the turtle module library and start a function name “ankure” and give the parameters “x” and “y”. Then, call the penup() procedure 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 code as “#ffffff”. Now starting the fill and set the particle to False. Then, set the value of the variable is “a” to 2.5. Besides, start a for loop with the range of 120. In this loop, checking inside if “i” which loops from 0 to 120 falls under (0 – 30) or (60 – 90). If yes, subtracted 0.5 from “a” and call the procedures lt() and fd() with the arguments “3” and “a”. If no, add 0.5 tp “a” and call the procedures lt() and fd() as above. Now, completely fill.
- Approprietely, start a function named “daari()” and call “ankure” with the arguments (-32, 135), the Seth procedure with the argument 165, and the fd() procedure with the argument 60. As well , do the same as above by change the seth, fd, and the 2nd argument of “ankure” as written in the above code.
- Similarly, in the 2nd part of our code to Draw 2d Graphic Doraemon start a function mukh(). Inside this function, call the ankure() function with the arguments (5, 148). Likely, call the seth this procedure with the argument “270” and fd() with “100”. Again, call the seth() process with 0 and draw a circle with the arguments “120, 100”. Later, call the Seth(230) and circle(-120, 100).
- similarily, start a function muflar(). Interior this function, fill the part with the color #e70010. Then, start the fill and call the seth(0) and fd(200) and draw a circle(-5, 90). comparability, call the fd() process with the argument 207 and circle(-5, 90) . And anew, fd(10) and circle (-5, 90).
- Appropriately, start function name nak(). Interior this function, call the “ankure” function with the arguments (-10. 158) and seth(315). Then fill the part with the color #e70010 and start the fill. As the nose is individual one circle, to draw a circle(20) and end the fill.
3rd part :- ( Last three Body Parts ) :
- Besides, start a function named black_aankha(). Interior part of this function, call the seth(0) and ankure with the arguments (-20, 195). Then, fill the part with the color #00000 ( black ) and start the fill. Draw a circle(13) and end the 1st half. Now, set the pen size to 6 and call the “ankure” function with the arguments (20, 205), seth(75), circle(-10, 150), and set the pen size to 3. Again, call the “ankure” function with the arguments(-17, 200). Then, call seth(0), fill the part with (#ffffff) white, and start fill. Now, draw a circle(5) and fill the end part.
- Similarly, create a function name face() . Inside this function, call the fd(183), lt(45), fill with the color code #ffffff (white) and start the fill. Now, create a circle(120, 100), seth(180), fd(121) and putdown. Then, call seth(215), circle(120, 100), end the fill and call “ankure” with the arguments (63.56, 213.24). in addition, call seth(90), aankha(), seth(180) and pick the pen up. Later, call fd(60), pendown(), seth(90), aankha(), penup(), seth(180) and fd(64).
- Now, create a function tauko(). Interior this function, call penup(), circle(150, 40), pendown() and fill the part with the color code #00a0de. Then, start the fill and draw a circle(150, 280) and end the fill.
- In this project part, of “Draw Doraemon 2d graphics with python turtle”, create a function name Doraemon(). The whole in this part is coding interior this function.1st, call the taauko() function, muflar() function, face() function, nak() function, mukh() function, daari() function and ankure() function with the arguments (0, 0)
- Now, call the seth(0),pick the pen up() and draw the circle(150, 50) and put the pen down. Besides, call the seth() with the angle 30, fd(40), seth(70) and circle(-30, 270). After, fill the part with the color #00a0de and begin the fill. besides, call the seth() with the value of angle 230, fd() with the value 80, seth with the angle 90, circle(1000, 1), one more seth() with the angle -89 and circle(-1000, 10).
- Approprietly, 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.
- After, that call the seth with the angle 100 & circle(-1000, 9). One more, call the seth() process with the angle -86, circle(1000, 2), seth(230) and fd(40).
- Besides, draw a circle(-30, 230), seth() procedure with the angle 45, fd() process with the value 81, seth(0) and fd(203). Just, draw a circle(5, 90), fd(10), circle(5, 90), fd() procedure with the value 7, seth() process with the angle 40. Comparably, draw a circle(150, 10), seth(30), fd(40) and fill the end.
- Just Now call the seth(70) and fill the part with the color code is #ffffff (white) and start the fill. Draw a circle with the value -3- and fill the end.
- Similarly, call the ankure() function with the arguments (103.74, -182.59) and fill the part with the color #ffffff (white) and start the fill. At present, call the fd(15), circle(-15, 180), fd(90), circle(-15, 180), fd(10) & fill the end part.
- Just, call the “ankure()” function with the arguments (-96.26, -182.59) and seth with the angle 180. Then, fill the part with color #ffffff (white) and start the fill. Just, call the fd(15) and draw a circle(15, 180). one more call the fd(90), circle(15, 180) and fd(10) and fill the end.
- Approprietly, call the “ankure()” function with the arguments (-133.97, -91.81), seth() technique with the angle 50, fill the part with the color white and start the fill of circle(30) and end the fill.
- Now, again, call the “ankure” function with the arguments (-103.42, 15.09), seth() process with the angle 0, fd() with the value 38, again seth() with the angle 230 and start the fill. Draw the circle(90, 260) & the fill.
- Call the ankure() function (5, -40), seth() [rprocess with angle of 0, fd() with the value 70, seth with the angle of -90, circle(-70, 180), anew seth with 0 and at lat fd with the value 70.
- As this is the last code to Draw Doraemon graphics with Python Turtle, call the “ankure()” function with the arguments (-103.42, 15.09), fd() with the value of 90, seth() procedure with the angle of 70. Fill the part with the color code is #ffd200 and start the fill. Just now, draw a circle(-20) & fill the end. Call the seth() process with the angle of 170 and full the part with the color #ffd200 & one more begin the fill, Draw a circle(-2, 180), seth() process with the angle of 10. Now, draw 2 circle with the arguments (-100, 22) and (-1, 180) individually. Then, call the seth() process with the angle of 90, circle(100, 22), and end the fill.
- Go to (-13.42, 15.09) and call the process seth() with the angle of 250. Drawing the circle of (20, 110), seth with the angle of 90, fd() with the value of 15, dot() process with the value of 10. finally, ankure() function with the logic (0, -150) and the black_aankha() function.
- In last part, write the module source code file of the main program. that is __name__ == “__main__” and set the screensize to (800, 600) and the bg color to #f0f0f0. then set the pen size to 3 and set the speed to 9. Now, call the Doraemon() function and the ankure() function with the arguents (100, -300). Run the Tkinter library event loop “mainloop()”.
__________________________________________________
Thanks a lot to expect supotronix projects & getting better experience till of ends!!