Wednesday 8 January 2014

Drawing the Olympic Rings Logo in python

Here we Have just use simple graphical programming for make some fun, There are many ways to write graphics programs in Python. A simple way to start graphics programming is to use Python’s built-in turtlemodule. Later in the book, we will introduce Tkinterfor developing comprehensive graphical user interface applications.

1 import turtle
2
3 turtle.color("blue")
4 turtle.penup()
5 turtle.goto(-110, -25)
6 turtle.pendown()
7 turtle.circle(45)
8
9 turtle.color("black")
10 turtle.penup()
11 turtle.goto(0, -25)
12 turtle.pendown()
13 turtle.circle(45)
14
15 turtle.color("red")
16 turtle.penup()
17 turtle.goto(110, -25)
18 turtle.pendown()
19 turtle.circle(45)
20
21 turtle.color("yellow")
22 turtle.penup()
23 turtle.goto(-55, -75)
24 turtle.pendown()
25 turtle.circle(45)
26
27 turtle.color("green")
28 turtle.penup()
29 turtle.goto(55, -75)
30 turtle.pendown()
31 turtle.circle(45)
32
33 turtle.done()

8 comments:

  1. you are jesus m8

    ReplyDelete
    Replies
    1. Lord Jesus Christ is Jesus not that person.

      Delete
  2. import turtle
    turtle.color("blue")
    turtle.penup()
    turtle.goto(-110, -25)
    turtle.pendown()
    turtle.circle(45)
    turtle.color("black")
    turtle.penup()
    turtle.goto(0, -25)
    turtle.pendown()
    turtle.circle(45)
    turtle.color("red")
    turtle.penup()
    turtle.goto(110, -25)
    turtle.pendown()
    turtle.circle(45)
    turtle.color("yellow")
    turtle.penup()
    turtle.goto(-55,-75)
    turtle.pendown()
    turtle.circle(45)
    turtle.color("green")
    turtle.penup()
    turtle.goto(55,-75)
    turtle.pendown()
    turtle.circle(45)
    turtle.done()

    the perfect code for logo...try this

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Find below another version of the Olympic symbol program, that draws the symbol for any radius the user enters

    NB:
    No selection statements or looping constructs present because I am still learning the syntax

    # This program prompts the user to enter the radius of the rings and draws an Olympic symbol of five rings of the
    # same size with the colors blue, black, red, yellow, and green,

    import turtle

    radius = eval(input("Enter the radius of the circle: "))


    #Blue circle
    turtle.penup()
    turtle.goto(-radius, radius)
    turtle.pendown()


    turtle.color('blue')
    turtle.speed(9)
    turtle.circle(radius)

    #Black circle
    turtle.penup()
    turtle.speed(9)
    turtle.forward(radius * 3)
    turtle.pendown()

    turtle.color('black')
    turtle.speed(9)
    turtle.circle(radius)

    #Red circle
    turtle.penup()
    turtle.speed(9)
    turtle.forward(radius * 3)
    turtle.pendown()

    turtle.color('red')
    turtle.speed(9)
    turtle.circle(radius)

    #Yellow circle
    turtle.penup()
    turtle.goto(-radius, -radius / 8)
    turtle.speed(9)
    turtle.pendown()


    turtle.penup()
    turtle.speed(9)
    turtle.forward(radius * 1.5)
    turtle.pendown()

    turtle.color('yellow')
    turtle.speed(9)
    turtle.circle(radius)

    #Green Circle
    turtle.penup()
    turtle.speed(9)
    turtle.forward(radius * 3)
    turtle.pendown()


    turtle.color('green')
    turtle.speed(9)
    turtle.circle(radius)

    turtle.done()

    ReplyDelete
  5. My solution:
    ============
    from turtle import *

    speed(0); width(10)

    color("blue"); circle(50)
    pu(); fd(130); pd()

    color('black'); circle(50)
    pu(); fd(130); pd()

    color('red'); circle(50)

    pu(); setpos(65, -50); pd()
    color('yellow'); circle(50)
    pu(); fd(130); pd()

    color('green'); circle(50)

    ReplyDelete
  6. narayana, whom are you addressing here?
    Yehuda

    ReplyDelete
  7. Good post. I learn something tougher on different blogs everyday. It'll at all times be stimulating to learn content from other writers and observe somewhat one thing from their store. I’d choose to use some with the content on my blog whether or not you don’t mind. Natually I’ll offer you a link in your internet blog. Thanks for sharing. https://python.engineering/3659142-bulk-insert-with-sqlalchemy-orm/

    ReplyDelete