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

Tuesday, August 10, 2021

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

How to Draw a Shinchan in Python - There are various methods to create a Shinchan using python libraries like turtle, tkinter and matplotlib. Also, you will learn how to make a Shinchan using python in easy and simple steps. We have also provided the python code for drawing a Shinchan 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 Shinchan patterns in Python using libraries from its scientific stack, including NumPy, Matplotlib, Pandas, and Seaborn.


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


How to Draw a Shinchan using Python?

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


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


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

How to Draw a Shinchan using Python Turtle?

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

Step

  1. Import everything from the turtle module using from turtle import *
  2. Now, create a class named Shinchan and create its constructor. Inside the constructor create a screen object and set it as a class data member. Also set screen size, speed, and pensize.
  3. Create myPosition Method inside Shinchan class which will take two parameters and move the cursor to given x, y coordinates without drawing.
  4. Create shorts method inside the Shinchan class, In this method, we will write the code to draw the shorts of Shinchan using different turtle functions like fillcolor()begin_fill()right()forward()left(), and end_fill().
  5. Define another Method named leftLeg() inside Shinchan class. Here, set the position of the cursor to (-39, -25) using myPosition() Method. Set fill color as ‘#ffd699’ and Begin the fill using begin_fill(). Now we will use right()forward()left() and end_fill().
  6. Define other methods for different body parts like HeadleftSockleftShoerightLeg etc. In these methods we are mostly using turtle methods like left()right()forward()begin_fill()fillcolor(), and endfill() etc.
  7. Now create a method named allLegs() in Shinchan class for combining legs and inside this function call leftLeg()leftSock()leftShoe()rightLeg()rightSock()rightShoe() to draw the legs of Shinchan.
  8. Same as allLegs() method create other methods for combining other parts of the body of Shinchan like allHands()allEyebrows()allEyes(). And, Inside these function call methods associated with drawing the other parts of the Shinchan Respectively.
  9. After completing the above step, Now create a method named start() inside the Shinchan class and inside this method call the methods shorts()allLegs()myShirt()myHead()allHands()myMouth()allEyebrows()allEyes()myRobot() to start the drawing process. after it call the ht() method to hide the turtle cursor.
  10. Now at the end of the file outside the class create an object of Shinchan class and call the start method of Shinchan class using the object you just created.

Code

from turtle import *


class Shinchan:
def __init__(self):
self.wn = Screen()
self.wn.setup(width=800, height=800)
speed(9)
pensize(2)

def myPosition(self, x, y):
penup()
goto(x, y)
pendown()

def shorts(self):
fillcolor('#ffec40')
begin_fill()
right(25)
forward(20)
right(45)
forward(20)
left(70)
forward(90)
left(95)
forward(75)
left(85)
forward(175)
left(85)
forward(75)
left(95)
forward(90)
left(85)
forward(18)
end_fill()

def leftLeg(self):
self.myPosition(-39, -25)
fillcolor("#ffd699")
begin_fill()
right(89)
forward(25)
right(90)
forward(50)
right(90)
forward(20)
right(85)
forward(50)
end_fill()

def leftSock(self):
self.myPosition(-36, -78)
fillcolor("#ffffff")
begin_fill()
right(90)
circle(80, 13)
right(110)
forward(22)
right(85)
forward(19)
right(90)
forward(21)
end_fill()

def leftShoe(self):
self.myPosition(-69, -112)
fillcolor("#b5ae60")
begin_fill()
right(90)
left(5)
forward(56)
left(105)
forward(13)
left(75)
forward(20)
right(90)
forward(15)
circle(10, 15)
left(80)
forward(4)
circle(10, 15)
left(40)
circle(20, 15)
forward(10)
right(45)
forward(15)
circle(25, 25)
end_fill()

def rightLeg(self):
self.myPosition(60, -28)
fillcolor("#ffd699")
begin_fill()
# right(90)
left(128)
forward(25)
right(95)
forward(55)
right(90)
forward(20)
right(85)
forward(55)
end_fill()

def rightSock(self):
self.myPosition(64, -79)
fillcolor("#ffffff")
begin_fill()
right(90)
circle(90, 14)
right(110)
forward(23)
right(90)
forward(15)
right(80)
forward(21)
end_fill()

def rightShoe(self):
self.myPosition(64, -108)
fillcolor("#b5ae60")
begin_fill()
right(100)
forward(56)
left(160)
forward(25)
right(68)
forward(17)
left(90)
circle(18, 15)
forward(5)
left(75)
forward(11)
right(85)
forward(20)
left(45)
circle(10, 30)
left(25)
forward(5)
end_fill()

def myShirt(self):
self.myPosition(-75, 48)
fillcolor("red")
begin_fill()
left(72)
forward(185)
left(87)
forward(75)
right(68)
circle(20, 8)
circle(300, 23)
left(90)
circle(35, 17)
right(38)
circle(35, 17)
left(58)
forward(75)
right(12)
forward(140)
right(40)
forward(93)
left(120)
circle(-20, 65)
left(75)
forward(10)
left(23)
forward(88)
# circle(-80,10)
right(31)
forward(87)
right(180)
forward(108)
right(180)
forward(104)
circle(10, 70)
end_fill()

def myHead(self):
self.myPosition(-20, 295)
left(20)
pensize(2)
fillcolor('#fcc6a0')
begin_fill()
right(90)
forward(40)
right(90)
circle(50, 80)
left(10)
circle(50, 80)
left(2)
circle(200, 50)

left(48)
forward(60)
# left(20)
circle(45, 60)
right(5)
circle(100, 85)
end_fill()
fillcolor('black')
begin_fill()

pensize(2)
right(170)
circle(-100, 165)
right(78)
forward(26)
right(87)
forward(55)
circle(45, 60)
right(5)
circle(100, 85)
end_fill()

fillcolor('#fcc6a0')
begin_fill()
right(180)
circle(-100, 105)
right(37)
forward(49)
pensize(2)
left(130)
forward(30)
# right(5)
circle(-10, 70)
right(50)
# circle(10,10)
forward(36)
right(80)
forward(50)
pencolor('#fcc6a0')
right(90)
forward(30)

end_fill()

def rightHand(self):
# left(35)
self.myPosition(197, 209)
pencolor('black')
fillcolor('#fcc6a0')
begin_fill()
right(45)
forward(6)
left(55)
forward(20)
circle(-5, 70)
right(100)
forward(18)
left(105)
forward(18)
circle(-5, 70)
right(100)
forward(18)
left(145)
forward(15)
circle(-5, 70)
right(100)
forward(18)

left(150)
forward(13)
circle(-5, 70)
right(100)
forward(15)

left(150)
forward(10)
circle(-5, 70)
right(100)
forward(12)
circle(60, 10)
left(45)
forward(6)
right(90)
forward(10)
end_fill()

def leftHand(self):
self.myPosition(-94, 242)
fillcolor('#fcc6a0')
begin_fill()
right(10)
forward(6)
left(90)
penup()
forward(12)
pendown()
left(90)
forward(8)
left(90)
forward(12)
end_fill()

def myBis(self):
self.myPosition(-103, 291)
right(90)
fillcolor('#02d302')
begin_fill()
right(90)
forward(55)
left(80)
forward(12)
left(10)
forward(17)
left(10)
forward(12)
left(80)
forward(55)
left(80)
forward(12)
left(10)
forward(17)
left(10)
forward(12)
left(80)
left(80)
forward(12)
left(10)
forward(17)
left(10)
forward(12)
end_fill()
penup()
right(100)
forward(20)
right(90)
forward(14)
pendown()
pencolor('#9c5e4a')
fillcolor('#9c5e4a')
begin_fill()
for i in range(5):
forward(15)
right(144)
end_fill()
penup()
forward(27)
left(90)
forward(16)
left(90)
forward(7)
pendown()
fillcolor('#9c5e4a')
begin_fill()
for i in range(5):
forward(10)
right(144)
end_fill()
penup()
forward(20)
right(90)
forward(5)
pendown()
fillcolor('#9c5e4a')
begin_fill()
for i in range(5):
forward(10)
right(144)
end_fill()
penup()
right(180)
forward(6)
pendown()
fillcolor('#9c5e4a')
begin_fill()
for i in range(5):
forward(10)
right(144)
end_fill()

def leftHand2(self):
self.myPosition(-112, 284)
pencolor('black')
fillcolor('#fcc6a0')
begin_fill()
right(180)
forward(31)
left(90)
for i in range(2):
circle(4, 90)
for i in range(3):
right(180)
for i in range(2):
circle(4, 90)
end_fill()

def myMouth(self):
self.myPosition(-25, 200)
left(65)
fillcolor('#77332e')
begin_fill()
# circle(20)
# forward(20)
for i in range(2):
circle(25, 90)
circle(25 // 2, 90)
end_fill()

def myEyebrow(self, x, y):
self.myPosition(x, y)
pensize(18)
right(150)
forward(25)
right(90)
for i in range(1):
right(45)
dot(15)
left(55)
forward(25)
for i in range(1):
right(45)
dot(15)

def myEyelid(self, x, y):
self.myPosition(x, y)
pensize(2)
left(170)
circle(-23, 180)

def myallEyes1(self, x, y):
self.myPosition(x, y)
right(90)
fillcolor('#000000')
begin_fill()
circle(18)
end_fill()
left(90)
penup()
forward(19)
right(90)
forward(7)
pendown()
fillcolor('#ffffff')
begin_fill()
left(90)
circle(9)
end_fill()

def myallEyes2(self, x, y):
self.myPosition(x, y)
right(90)
fillcolor('#000000')
begin_fill()
circle(18)
end_fill()
left(90)
penup()
forward(19)
right(90)
forward(8)
pendown()
fillcolor('#ffffff')
begin_fill()
left(90)
circle(9)
end_fill()

def myRobot(self):
self.myPosition(155, -105)
left(93)
color('red')
pensize(7)

begin_fill()
forward(50)
left(90)
forward(50)
left(90)
forward(50)
left(90)
forward(50)
left(90)
end_fill()

color('white')
penup()
left(90)
forward(30)
right(90)
forward(12)
pendown()
pensize(3)
circle(5)
penup()
forward(25)
pendown()
circle(5)

penup()
right(90)
forward(20)
right(90)
pendown()

begin_fill()
forward(23)
right(90)
forward(7)
right(90)
forward(23)
right(90)
forward(7)
right(90)
end_fill()

penup()
forward(25)
right(90)
forward(35)
pendown()

color('red')
forward(30)
penup()
right(90)
pendown()
begin_fill()
circle(5)
end_fill()

def allLegs(self):
self.leftLeg()
self.leftSock()
self.leftShoe()
self.rightLeg()
self.rightSock()
self.rightShoe()

def allHands(self):
self.rightHand()
self.leftHand()
self.myBis()
self.leftHand2()

def allEyebrows(self):
self.myEyebrow(-8, 300)
right(90)
self.myEyebrow(72, 300)
self.myEyelid(-9, 270)
left(15)
self.myEyelid(68, 265)

def allEyes(self):
self.myallEyes1(17, 275)
self.myallEyes2(95, 270)

def my_goto(self, x, y):
penup()
goto(x, y)
pendown()

def start(self):
self.shorts()
self.allLegs()
self.myShirt()
self.myHead()
self.allHands()
self.myMouth()
self.allEyebrows()
self.allEyes()
self.myRobot()
ht()
self.my_goto(80, -200)
write('CoderIndia.in', font=("Bradley Hand ITC", 30, "bold"))
done()

if __name__ == "__main__":
obj = Shinchan()
obj.start()

Output

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


How to Draw a Shinchan using Python Tkinter?

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


Step

Code

Output

How to Draw a Shinchan using Python Matplotlib?

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


Step

Code

Output

How to Draw a Shinchan 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 Shinchan using Python

We hope the programs and methods provided above on how to make a Shinchan 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 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

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
Copyright © HSSlive: Plus One & Plus Two Notes & Solutions for Kerala State Board About | Contact | Privacy Policy