From 253ee2a40f61a524727885e71b17b25e16be9769 Mon Sep 17 00:00:00 2001 From: Rajarshi Banerjee Date: Wed, 6 Oct 2021 18:29:03 +0530 Subject: [PATCH] Added a new python script --- Draw python logo using python/Readme.md | 18 +++ Draw python logo using python/main.py | 167 ++++++++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 Draw python logo using python/Readme.md create mode 100644 Draw python logo using python/main.py diff --git a/Draw python logo using python/Readme.md b/Draw python logo using python/Readme.md new file mode 100644 index 00000000..39c35fc5 --- /dev/null +++ b/Draw python logo using python/Readme.md @@ -0,0 +1,18 @@ +# Draw python logo + + + +### Modules required: +``` +pip install PythonTurtle +``` + +### Importing the module + +```python +import turtle +``` + +## Output of this code: + + diff --git a/Draw python logo using python/main.py b/Draw python logo using python/main.py new file mode 100644 index 00000000..7f1f0143 --- /dev/null +++ b/Draw python logo using python/main.py @@ -0,0 +1,167 @@ +import turtle as t +'''Author: Rajarshi Banerjee | GSAUC3''' +class logo: + + def __init__(i,t) -> None: + i.t=t + + def blue_part(i): + i.t.penup() + + # d = 200 + # x = 10 + i.t.pencolor('blue') + i.t.color('blue') + i.t.goto(-110,-100) + i.t.pendown() + i.t.begin_fill() + i.t.right(180) + i.t.forward(100/3) + + for _ in range(5): + i.t.right(15) + i.t.forward(15) + i.t.forward(15) + i.t.right(5) + for _ in range(5): + i.t.forward(15) + i.t.right(5) + i.t.forward(27.58789) + for _ in range(5): + i.t.right(15) + i.t.forward(15) + + + + i.t.goto(0,100) + i.t.goto(0,110) + i.t.goto(-100,110) + i.t.goto(-100,110+100/3) + i.t.left(90) + + for _ in range(5): + i.t.right(15) + i.t.forward(15) + i.t.forward(15) + i.t.right(5) + for _ in range(5): + i.t.forward(15) + i.t.right(5) + i.t.forward(27.58789) + for _ in range(5): + i.t.right(15) + i.t.forward(15) + + i.t.forward(60+10) + + + for _ in range(5): + i.t.right(15) + i.t.forward(15) + + i.t.right(5) + i.t.goto(-100+30,10) + + + for _ in range(5): + i.t.left(15) + i.t.forward(15) + i.t.left(5) + + i.t.goto(-110,-100) + i.t.end_fill() + + def yellow_part(i): + i.t.penup() + i.t.pencolor('yellow') + i.t.color('yellow') + i.t.goto(110,100) + i.t.right(90) + i.t.pendown() + i.t.begin_fill() + i.t.right(180) + i.t.forward(100/3) + + for _ in range(5): + i.t.right(15) + i.t.forward(15) + i.t.forward(15) + i.t.right(5) + for _ in range(5): + i.t.forward(15) + i.t.right(5) + i.t.forward(27.58789) + for _ in range(5): + i.t.right(15) + i.t.forward(15) + + + + i.t.goto(0,-100) + i.t.goto(0,-110) + i.t.goto(100,-110) + i.t.goto(100,-110-100/3) + i.t.left(90) + + for _ in range(5): + i.t.right(15) + i.t.forward(15) + i.t.forward(15) + i.t.right(5) + for _ in range(5): + i.t.forward(15) + i.t.right(5) + i.t.forward(27.58789) + for _ in range(5): + i.t.right(15) + i.t.forward(15) + + i.t.forward(60+10) + + + for _ in range(5): + i.t.right(15) + i.t.forward(15) + + i.t.right(5) + i.t.goto(70,-10) + + + for _ in range(5): + i.t.left(15) + i.t.forward(15) + i.t.left(5) + + i.t.goto(110,100) + i.t.end_fill() + + + def eyes(i): + i.t.penup() + i.t.color('white') + i.t.goto(-70,130) + i.t.pendown() + i.t.begin_fill() + i.t.circle(10) + i.t.end_fill() + + i.t.penup() + i.t.color('white') + i.t.goto(70+20,-130) + i.t.pendown() + i.t.begin_fill() + i.t.circle(10) + i.t.end_fill() + + i.t.hideturtle() + + + +if __name__ =="__main__": + t.Turtle() + obj=logo(t) + obj.blue_part() + obj.yellow_part() + obj.eyes() + t.done() +