capodeicapi icon

Ban The Bomb (Python)

capodeicapi | PRO | 04/20/24 08:20:51 PM UTC | 0 ⭐ | 1435 👁️ | Never ⏰ | [peace, banthebomb]
Python |

1.78 KB

|

Source Code

|

0 👍

/

0 👎

import turtle
 
# Set up the screen
screen = turtle.Screen()
screen.setup(width=1.0, height=1.0)  # Use full screen
screen.bgcolor("black")
 
# Create a turtle object
pen = turtle.Turtle()
pen.speed(6)  # Set the speed of the turtle (0 is the fastest)
pen.color("red")
turtle.showturtle()
 
# Calculate radius
screen_height = screen.window_height()
radius = (1 / 3) * screen_height
 
 
# Draw the circle
# Set pen properties
pen.color("red")  # Set the pen color to red
pen.width(20)  # Set the line width to 20
pen.speed(6)
pen.penup()
pen.goto(0, -radius)
pen.pendown()
# Draw a circle
pen.circle(radius)  # Draw a circle with a radius of 100
 
 
# Draw a line through the center of the circle
pen.color("red")
pen.penup()
pen.goto(0, -radius)
pen.setheading(90)  # Set the direction of the turtle to upwards
pen.width(20)  # Set the thickness of the line
pen.pendown()
pen.forward(radius * 2)  # Draw the line through the center of the circle
 
# Draw the sidelines
pen.color("red")
 
pen.penup()
pen.goto(0, -radius/3)
pen.setheading(225)  # Set the direction of the turtle
pen.width(20)  # Set the thickness of the line
pen.pendown()
pen.forward(0.7*radius)  # Draw the line through the center of the circle
 
pen.penup()
pen.goto(0, -radius/3)
pen.setheading(315)  # Set the direction of the turtle
pen.width(20)  # Set the thickness of the line
pen.pendown()
pen.forward(0.7*radius)  # Draw the line through the center of the circle
 
 
# Print PEACE
pen.penup()
pen.color("white")
pen.goto(0, -radius + 80)  # Position the turtle to print text below the circle
pen.pendown()
pen.write("PEACE!".format(screen_height), align="center", font=("Comic Sans MS", 80, "normal"))
 
 
 
# Hide the turtle
pen.hideturtle()
 
# Keep the window open
screen.mainloop()
 

Comments