banner
andrewji8

Being towards death

Heed not to the tree-rustling and leaf-lashing rain, Why not stroll along, whistle and sing under its rein. Lighter and better suited than horses are straw sandals and a bamboo staff, Who's afraid? A palm-leaf plaited cape provides enough to misty weather in life sustain. A thorny spring breeze sobers up the spirit, I feel a slight chill, The setting sun over the mountain offers greetings still. Looking back over the bleak passage survived, The return in time Shall not be affected by windswept rain or shine.
telegram
twitter
github

Mid-Autumn Festival moon appreciation special code Mid-Autumn Festival code

Program Running Screenshot: The background music required for the program can be downloaded at the end of the document, or it can be replaced by yourself.

import turtle
import time
import pygame


def drawMoon():            # Draw the moon
  turtle.penup()   # Lift the pen
  turtle.goto(-150, 0)
  turtle.fillcolor((255, 215, 0))   # Color of the full moon
  turtle.pendown()   # Put down the pen
  turtle.begin_fill()
  turtle.circle(112)
  turtle.end_fill()  # Color filling from turtle.begin_fill() to turtle.end_fill()
def drawCloud():           # Draw clouds
   turtle.penup()
   turtle.goto(-500, 200)
   turtle.fillcolor((245, 245, 245))
   turtle.pencolor((255, 255, 255))
   turtle.pensize(5)
   turtle.pendown()
   turtle.forward(250)
   def cloud(mode='right'):
      for i in range(90):
         turtle.pensize((i+1)*0.2+5)
         turtle.right(1) if mode == 'right' else turtle.left(1)
         turtle.forward(0.5)
      for i in range(90):
         turtle.pensize(90*0.2+5-0.2*(i+1))
         turtle.right(1) if mode == 'right' else turtle.left(1)
         turtle.forward(0.5)
   cloud()
   turtle.forward(100)
   cloud('left')
   turtle.forward(600)
def drawMountain():          # Draw mountains
   turtle.penup()
   turtle.goto(-500, -250)
   turtle.pensize(4)
   turtle.fillcolor((36, 36, 36))
   turtle.pencolor((31, 28, 24))
   turtle.pendown()
   turtle.begin_fill()
   turtle.left(20)
   turtle.forward(400)
   turtle.right(45)
   turtle.forward(200)
   turtle.left(60)
   turtle.forward(300)
   turtle.right(70)
   turtle.forward(300)
   turtle.goto(500, -300)
   turtle.goto(-500, -300)
   turtle.end_fill()
def initTurtle():
   pygame.mixer.init()
   pygame.mixer.music.load('ZXbg.mp3')# Add your own music
   pygame.mixer.music.play(-1, 20.0)
   turtle.hideturtle()
   turtle.setup(1000, 600)
   turtle.title('Mid-Autumn Moon Appreciation')
   turtle.colormode(255)
   turtle.bgcolor((193, 210, 240))
   turtle.speed(10)
def writePoetry():
  turtle.penup()
  turtle.goto(400, -150)
  turtle.pencolor((250, 240, 230))
  # Poetry
  poetry = ["\nWhen\nwill\nthe\nbright\nmoon\nappear\n", "Raise\nthe\ncup\nto\nthe\nblue\nsky\n"]
  # Poetry positions (can be designed and added by yourself), preferably 2/4 lines of a five-character poem
  coordinates = [(300, -150), (200, -150), (100, -150)]
  for i, p in enumerate(poetry):
    turtle.write(p, align="center", font=("STXingkai", 50, "bold"))
    if (i + 1) != len(poetry):
      time.sleep(2)
      turtle.goto(coordinates[i])
def main():
    initTurtle()
    drawMoon()          # Draw the moon
    drawCloud()         # Draw clouds
    drawMountain()      # Draw mountains
    writePoetry()       # Write poetry
    turtle.done()

if __name__ == '__main__':
    main()
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.