Breaking

Sunday, May 28, 2023

Draw Pokémon using python

pokemon


Introduction

Welcome to the enchanting realm of Pokémon, a mesmerizing multimedia franchise that has woven itself into the fabric of popular culture, captivating fans of all ages around the world. Originating from the imagination of Satoshi Tajiri and Ken Sugimori, Pokémon emerged as a phenomenon that transcended its humble beginnings to become a global sensation.

At the heart of Pokémon is a diverse array of captivating creatures, each possessing unique abilities and characteristics. These creatures, known as Pokémon, inhabit a world where Trainers embark on thrilling adventures to catch, train, and battle with these fantastical companions. From the iconic Pikachu to the majestic Mewtwo, the Pokémon universe is teeming with creatures that have become beloved symbols in the hearts of fans.

The cultural impact of Pokémon extends far beyond its origins, encompassing animated TV series, movies, trading card games, and video games. Pokémon has evolved into a multimedia juggernaut, creating a rich tapestry of stories that explore themes of friendship, perseverance, and the pursuit of dreams.

Join us on an exploration of the basics of Pokémon, as we unravel the magic behind the enduring appeal of these creatures and the exhilarating journeys of Pokémon Trainers. Whether you're a seasoned Pokémon Master or a newcomer to this fantastical universe, prepare to immerse yourself in a world filled with excitement, camaraderie, and the timeless quest to become the very best. So, tighten your Poké Balls, sharpen your skills, and embark on a journey where the bonds between Trainer and Pokémon spark adventures that transcend generations.

Pokémon: Exploring a World of Creatures and Dreams

In the vibrant tapestry of popular culture, Pokémon stands as a luminary, enchanting generations with its captivating universe of creatures, adventures, and dreams. Conceived by Satoshi Tajiri and illustrated by Ken Sugimori, Pokémon emerged as a Japanese gaming concept in the 1990s, swiftly evolving into a global phenomenon that transcends borders and ages.

At its core, Pokémon is a fantastical world inhabited by a diverse array of creatures, each possessing unique abilities and characteristics. These creatures, affectionately known as Pokémon, form the backbone of an intricate ecosystem where Trainers, individuals who capture and train Pokémon, embark on grand journeys of exploration, friendship, and fierce battles.

From the electrically charged Pikachu to the mystical Mewtwo, each Pokémon has become an iconic symbol, instilling a sense of wonder and nostalgia in the hearts of fans. The franchise's cultural impact extends far beyond the realm of video games, branching into animated TV series, movies, trading card games, and a plethora of merchandise.

Pokémon's allure lies not only in the thrill of capturing and training these fantastical creatures but also in the universal themes woven into its narratives. Friendship, courage, and the pursuit of one's dreams are recurring motifs, resonating with audiences across the globe and across generations.

As Trainers journey through Pokémon regions, encountering Gym Leaders, battling villainous teams, and striving to become Pokémon Masters, they weave stories of perseverance and camaraderie. Pokémon is not merely a collection of creatures; it is a tapestry of dreams, aspirations, and the enduring spirit of adventure.

In this ever-expanding universe, Pokémon continues to evolve, inviting new generations to experience the magic of a world where creatures and dreams intermingle. So, whether you're a seasoned Trainer or a curious newcomer, prepare to delve into a realm where the pursuit of becoming a Pokémon Master is an exhilarating odyssey that transcends time and borders.

Coding Pokémon Magic: Drawing Pikachu with Turtle Graphics

Embarking on a magical coding adventure, we explore the world of Pokémon through the creative lens of Turtle Graphics in Python. This playful journey allows us to bring the iconic Pikachu to life on a virtual canvas, merging the charm of Pokémon with the interactive coding experience.

To begin, set up your Python environment and import the Turtle module, which becomes the digital artist, responding to commands to draw shapes and lines. Start by sketching the foundational shapes that define Pikachu – a rounded body, pointy ears, and distinctive facial features.

Specify the vibrant colors that make Pikachu instantly recognizable. Utilize Turtle Graphics' fill color command to infuse Pikachu with the cheerful yellows and reds that characterize this beloved Pokémon. The simplicity of Turtle Graphics makes it an ideal platform for capturing Pikachu's iconic appearance with precision.

As you progress, employ Turtle Graphics commands to draw Pikachu's expressive eyes, rosy cheeks, and lightning bolt-shaped tail. Experiment with the penup and pendown commands to navigate between different parts of the drawing without leaving unwanted lines, ensuring a clean and polished outcome.

Enhance the Pikachu drawing by adding playful details like its endearing smile and the pouch-like markings on its cheeks. Turtle Graphics allows for creative experimentation, making the coding process both engaging and personalized.

Drawing Pikachu with Turtle Graphics is not just about replicating an image; it's an immersive learning experience that combines artistry with programming logic. The interactive nature of Turtle Graphics transforms coding into a visual and playful endeavor, making it accessible and enjoyable for enthusiasts of all levels.

As Pikachu materializes on the virtual canvas, the joy of coding blends with the magic of Pokémon, offering a tangible and creative connection to this iconic character. So, grab your coding pen, let Turtle Graphics guide you, and embark on the enchanting quest of drawing Pikachu in Python – a delightful fusion of technology and Pokémon magic.

Implementation

In This Blog I will Teach You How we can draw Line Art Using Python in only few Lines of code. Just copy paste the source code below in python editor run program to see output
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(10) 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.fillcolor('#ffffff') t.begin_fill() t.circle(10) t.end_fill() def rightEye(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.fillcolor('#ffffff') t.begin_fill() t.circle(10) t.end_fill() def mouth(self, x, y): self.noTrace_goto(x, y) t = self.t t.fillcolor('#88141D') t.begin_fill() # lower lip l1 = [] l2 = [] t.seth(190) a = 0.7 for i in range(28): a += 0.1 t.right(3) t.fd(a) l1.append(t.position()) self.noTrace_goto(x, y) t.seth(10) a = 0.7 for i in range(28): a += 0.1 t.left(3) t.fd(a) l2.append(t.position()) # Upper lip t.seth(10) t.circle(50, 15) t.left(180) t.circle(-50, 15) t.circle(-50, 40) t.seth(233) t.circle(-50, 55) t.left(180) t.circle(50, 12.1) t.end_fill() # tongue self.noTrace_goto(17, 54) t.fillcolor('#DD716F') t.begin_fill() t.seth(145) t.circle(40, 86) t.penup() for pos in reversed(l1[:20]): t.goto(pos[0], pos[1] + 1.5) for pos in l2[:20]: t.goto(pos[0], pos[1] + 1.5) t.pendown() t.end_fill() # nose self.noTrace_goto(-17, 94) t.seth(8) t.fd(4) t.back(8) # Red cheeks def leftCheek(self, x, y): turtle.tracer(False) t = self.t self.noTrace_goto(x, y) t.seth(300) t.fillcolor('#DD4D28') t.begin_fill() a = 2.3 for i in range(120): if 0 <= i < 30 or 60 <= i < 90: a -= 0.05 t.lt(3) t.fd(a) else: a += 0.05 t.lt(3) t.fd(a) t.end_fill() turtle.tracer(True) def rightCheek(self, x, y): t = self.t turtle.tracer(False) self.noTrace_goto(x, y) t.seth(60) t.fillcolor('#DD4D28') t.begin_fill() a = 2.3 for i in range(120): if 0 <= i < 30 or 60 <= i < 90: a -= 0.05 t.lt(3) t.fd(a) else: a += 0.05 t.lt(3) t.fd(a) t.end_fill() turtle.tracer(True) def colorLeftEar(self, x, y): t = self.t self.noTrace_goto(x, y) t.fillcolor('#000000') t.begin_fill() t.seth(330) t.circle(100, 35) t.seth(219) t.circle(-300, 19) t.seth(110) t.circle(-30, 50) t.circle(-300, 10) t.end_fill() def colorRightEar(self, x, y): t = self.t self.noTrace_goto(x, y) t.fillcolor('#000000') t.begin_fill() t.seth(300) t.circle(-100, 30) t.seth(35) t.circle(300, 15) t.circle(30, 50) t.seth(190) t.circle(300, 17) t.end_fill() def body(self): t = self.t t.speed(10) t.fillcolor('#F6D02F') t.begin_fill() # Right face Contour t.penup() t.circle(130, 40) t.pendown() t.circle(100, 105) t.left(180) t.circle(-100, 5) # Right ear t.seth(20) t.circle(300, 30) t.circle(30, 50) t.seth(190) t.circle(300, 36) # upper profile t.seth(150) t.circle(150, 70) # left ear t.seth(200) t.circle(300, 40) t.circle(30, 50) t.seth(20) t.circle(300, 35) # print(t.pos()) # Left face contour t.seth(240) t.circle(105, 95) t.left(180) t.circle(-105, 5) # left hand t.seth(210) t.circle(500, 18) t.seth(200) t.fd(10) t.seth(280) t.fd(7) t.seth(210) t.fd(10) t.seth(300) t.circle(10, 80) t.seth(220) t.fd(10) t.seth(300) t.circle(10, 80) t.seth(240) t.fd(12) t.seth(0) t.fd(13) t.seth(240) t.circle(10, 70) t.seth(10) t.circle(10, 70) t.seth(10) t.circle(300, 18) t.seth(75) t.circle(500, 8) t.left(180) t.circle(-500, 15) t.seth(250) t.circle(100, 65) # left foot t.seth(320) t.circle(100, 5) t.left(180) t.circle(-100, 5) t.seth(220) t.circle(200, 20) t.circle(20, 70) t.seth(60) t.circle(-100, 20) t.left(180) t.circle(100, 20) t.seth(300) t.circle(10, 70) t.seth(60) t.circle(-100, 20) t.left(180) t.circle(100, 20) t.seth(10) t.circle(100, 60) t.seth(180) t.circle(-100, 10) t.left(180) t.circle(100, 10) t.seth(5) t.circle(100, 10) t.circle(-100, 40) t.circle(100, 35) t.left(180) t.circle(-100, 10) # Right foot t.seth(290) t.circle(100, 55) t.circle(10, 50) t.seth(120) t.circle(100, 20) t.left(180) t.circle(-100, 20) t.seth(0) t.circle(10, 50) t.seth(110) t.circle(100, 20) t.left(180) t.circle(-100, 20) t.seth(30) t.circle(20, 50) t.seth(100) t.circle(100, 40) # Right body contour t.seth(200) t.circle(-100, 5) t.left(180) t.circle(100, 5) t.left(30) t.circle(100, 75) t.right(15) t.circle(-300, 21) t.left(180) t.circle(300, 3) # Right hand t.seth(43) t.circle(200, 60) t.right(10) t.fd(10) t.circle(5, 160) t.seth(90) t.circle(5, 160) t.seth(90) t.fd(10) t.seth(90) t.circle(5, 180) t.fd(10) t.left(180) t.left(20) t.fd(10) t.circle(5, 170) t.fd(10) t.seth(240) t.circle(50, 30) t.end_fill() self.noTrace_goto(130, 125) t.seth(-20) t.fd(5) t.circle(-5, 160) t.fd(5) # Fingerprint self.noTrace_goto(166, 130) t.seth(-90) t.fd(3) t.circle(-4, 180) t.fd(3) t.seth(-90) t.fd(3) t.circle(-4, 180) t.fd(3) # tail self.noTrace_goto(168, 134) t.fillcolor('#F6D02F') t.begin_fill() t.seth(40) t.fd(200) t.seth(-80) t.fd(150) t.seth(210) t.fd(150) t.left(90) t.fd(100) t.right(95) t.fd(100) t.left(110) t.fd(70) t.right(110) t.fd(80) t.left(110) t.fd(30) t.right(110) t.fd(32) t.right(106) t.circle(100, 25) t.right(15) t.circle(-300, 2) t.seth(30) t.fd(40) t.left(100) t.fd(70) t.right(100) t.fd(80) t.left(100) t.fd(46) t.seth(66) t.circle(200, 38) t.right(10) t.fd(10) t.end_fill() # Tail pattern t.fillcolor('#923E24') self.noTrace_goto(126.82, -156.84) t.begin_fill() t.seth(30) t.fd(40) t.left(100) t.fd(40) t.pencolor('#923e24') t.seth(-30) t.fd(30) t.left(140) t.fd(20) t.right(150) t.fd(20) t.left(150) t.fd(20) t.right(150) t.fd(20) t.left(130) t.fd(18) t.pencolor('#000000') t.seth(-45) t.fd(67) t.right(110) t.fd(80) t.left(110) t.fd(30) t.right(110) t.fd(32) t.right(106) t.circle(100, 25) t.right(15) t.circle(-300, 2) t.end_fill() # Hat, eyes, mouth, cheeks self.cap(-134.07, 147.81) self.mouth(-5, 25) self.leftCheek(-126, 32) self.rightCheek(107, 63) self.colorLeftEar(-250, 100) self.colorRightEar(140, 270) self.leftEye(-85, 90) self.rightEye(50, 110) t.hideturtle() def cap(self, x, y): self.noTrace_goto(x, y) t = self.t t.fillcolor('#CD0000') t.begin_fill() t.seth(200) t.circle(400, 7) t.left(180) t.circle(-400, 30) t.circle(30, 60) t.fd(50) t.circle(30, 45) t.fd(60) t.left(5) t.circle(30, 70) t.right(20) t.circle(200, 70) t.circle(30, 60) t.fd(70) t.right(35) t.fd(50) t.circle(8, 100) t.end_fill() self.noTrace_goto(-168.47, 185.52) t.seth(36) t.circle(-270, 54) t.left(180) t.circle(270, 27) t.circle(-80, 98) t.fillcolor('#444444') t.begin_fill() t.left(180) t.circle(80, 197) t.left(58) t.circle(200, 45) t.end_fill() self.noTrace_goto(-58, 270) t.pencolor('#228B22') t.dot(35) self.noTrace_goto(-30, 280) t.fillcolor('#228B22') t.begin_fill() t.seth(100) t.circle(30, 180) t.seth(190) t.fd(15) t.seth(100) t.circle(-45, 180) t.right(90) t.fd(15) t.end_fill() t.pencolor('#000000') def start(self): self.body() def main(): # print('Started Painting the Pikachu... ') turtle.screensize(800, 600) turtle.title('Pikachu') pikachu = Pikachu() pikachu.start() turtle.mainloop() if __name__ == '__main__': main()

Conclusion

In the realm of Turtle Graphics and Python coding, our exploration of Pokémon has unfolded as a delightful journey, where technology and creativity intertwine. Drawing Pikachu and other iconic Pokémon using Turtle Graphics transcends the lines of code; it becomes an immersive experience that captures the essence of these beloved creatures.

As the digital canvas comes alive with the vibrant hues and distinctive features of Pokémon, the coding adventure evolves beyond a mere replication exercise. It transforms into an interactive and educational endeavor, offering enthusiasts a hands-on opportunity to merge artistic expression with programming logic.

The simplicity of Turtle Graphics provides an accessible platform for aspiring coders to engage with the magical world of Pokémon. Beyond the technicalities, the process serves as a bridge, connecting the joy of creativity with the allure of coding. Each line drawn and every command executed becomes a stroke of imagination, turning the screen into a dynamic canvas where Pikachu, Charmander, and Bulbasaur materialize with the magic of code.

Drawing Pokémon with Turtle Graphics is not just a coding project; it's a testament to the versatility of technology in unlocking creative potentials. It invites enthusiasts to explore the intersection of art and programming, fostering a deeper understanding of both disciplines in a playful and enjoyable manner.

So, as our Pokémon odyssey through Turtle Graphics concludes, the virtual canvas stands adorned with the vibrant presence of these iconic characters. The journey leaves behind not only visual masterpieces but also a sense of accomplishment, igniting the spark of curiosity and creativity that transcends the digital realm. Thus, the enchanting fusion of Pokémon and Turtle Graphics beckons aspiring coders and Pokémon trainers alike to embark on their own unique adventures, where the possibilities are as boundless as the Pokémon universe itself.


Stay up-to-date with our latest content by subscribing to our channel! Don't miss out on our next video - make sure to subscribe today.



No comments: