capodeicapi

Ban The Bomb (Python)

Apr 20th, 2024
1,479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.78 KB | Source Code | 0 0
  1. import turtle
  2.  
  3. # Set up the screen
  4. screen = turtle.Screen()
  5. screen.setup(width=1.0, height=1.0)  # Use full screen
  6. screen.bgcolor("black")
  7.  
  8. # Create a turtle object
  9. pen = turtle.Turtle()
  10. pen.speed(6)  # Set the speed of the turtle (0 is the fastest)
  11. pen.color("red")
  12. turtle.showturtle()
  13.  
  14. # Calculate radius
  15. screen_height = screen.window_height()
  16. radius = (1 / 3) * screen_height
  17.  
  18.  
  19. # Draw the circle
  20. # Set pen properties
  21. pen.color("red")  # Set the pen color to red
  22. pen.width(20)  # Set the line width to 20
  23. pen.speed(6)
  24. pen.penup()
  25. pen.goto(0, -radius)
  26. pen.pendown()
  27. # Draw a circle
  28. pen.circle(radius)  # Draw a circle with a radius of 100
  29.  
  30.  
  31. # Draw a line through the center of the circle
  32. pen.color("red")
  33. pen.penup()
  34. pen.goto(0, -radius)
  35. pen.setheading(90)  # Set the direction of the turtle to upwards
  36. pen.width(20)  # Set the thickness of the line
  37. pen.pendown()
  38. pen.forward(radius * 2)  # Draw the line through the center of the circle
  39.  
  40. # Draw the sidelines
  41. pen.color("red")
  42.  
  43. pen.penup()
  44. pen.goto(0, -radius/3)
  45. pen.setheading(225)  # Set the direction of the turtle
  46. pen.width(20)  # Set the thickness of the line
  47. pen.pendown()
  48. pen.forward(0.7*radius)  # Draw the line through the center of the circle
  49.  
  50. pen.penup()
  51. pen.goto(0, -radius/3)
  52. pen.setheading(315)  # Set the direction of the turtle
  53. pen.width(20)  # Set the thickness of the line
  54. pen.pendown()
  55. pen.forward(0.7*radius)  # Draw the line through the center of the circle
  56.  
  57.  
  58. # Print PEACE
  59. pen.penup()
  60. pen.color("white")
  61. pen.goto(0, -radius + 80)  # Position the turtle to print text below the circle
  62. pen.pendown()
  63. pen.write("PEACE!".format(screen_height), align="center", font=("Comic Sans MS", 80, "normal"))
  64.  
  65.  
  66.  
  67. # Hide the turtle
  68. pen.hideturtle()
  69.  
  70. # Keep the window open
  71. screen.mainloop()
  72.  
Advertisement
Add Comment
Please, Sign In to add comment