Mushroom cloud [empty board Python introductory tutorial] lesson 4: simulating the starry sky

Playful maker 2022-05-14 15:32:44 阅读数:548

mushroomcloudboardpythonintroductory

Simulated starry sky

Through the ages , People have a unique love for the starry sky . Look at the stars in the sky , Like eyes blinking in the dark , It's like shining stars 、 The shining pearl of the night , It's more like a little silver light flashing on the boundless ocean , All are fascinating .

In this class , We'll do it ourselves , Draw little stars , And make it float randomly on the blank board screen , Simulate a dynamic vast starry sky .

 Vast starry sky map

Mission objectives

Draw small stars on the screen and make them float .
 Effect drawing of starry sky on line board screen

Knowledge point

1、 know turtle library

2、 Learn to use turtle Library method for drawing stars

3、 Learn to use turtle Library of ways to make stars appear and float randomly

List of materials

 List of materials

Software use :Mind+ Programming software x1

Knowledge reserve

1、 What is? turtle library

turtle library , Also known as turtle drawing library , It is Python A very popular function library of drawing image in language . Its principle is to use the path of brush movement to generate graphics . We can use turtle Library to draw graphics on the screen , Like a rectangle 、 round 、 Pentagram, etc .

2、turtle General knowledge base

(1) turtle Space coordinate system

(A) Absolute coordinates

Take the middle of the screen as the origin (0,0), Form a four quadrant coordinate system .

turtle Space coordinate system

(B) Turtle coordinates

It's a coordinate system from the perspective of a turtle , Divided into four directions .

 Turtle coordinates

(2) canvas

canvas (Canvas), We can understand it as a piece of white paper , Different shapes can be drawn on it 、 Color 、 Thick and thin graphics . Every time the turtle draws a figure, it is displayed on an automatically generated canvas . The default size of the canvas is (400,300), among 400 Is the pixel value of the length ,300 Is the pixel value of the width . For canvas , We can set its size and initial position , You can also think of the canvas as a coordinate system , The little turtle moves every time from the coordinate origin (0,0) Departure .

 Canvas coordinates

(3) Three elements of turtle drawing

Turtle mapping has three key elements , That's the direction 、 Position and brush . During turtle mapping , The main thing is to control these elements to draw the graphics we want .

among , Direction is mainly used to control the moving direction of turtles . Position is mainly used to control the distance the turtle moves . The brush is mainly used as a drawing tool . In turtle drawing , You can control the thickness of the line through the brush 、 Color and speed of movement .

3、turtle Common functions of library screen control

turtle There are many functions about screen control in the library , We only use some of them , When programming , adopt “import turtle” After importing the library, you can use “turtle. Function name ()” To realize the function .Tips : The functions here come from TurtleScreen Methods in class .

(1)setup() Function to set the drawing window ( canvas ) The size and location of

adopt setup() Function, we can set the size and position of the current window screen , When the set parameter is an integer , In pixels , If you do not enter a parameter, it means default .

turtle.setup(240,320) # Set the drawing window size

among ,240 and 320 Refers to the width and height of the window respectively , The screen resolution is the same as that of the blank board .

(2)bgpic() Function to set the background picture of the screen

adopt bgpic() Function, we can set the background picture for the current window screen .

turtle.bgpic(“123.png”) # Setting the background

among ,“123.png” Refers to the specific background picture , In order to make the display effect more , We can adjust its size to match the screen .

(3)tracer() Function to animate on or off

adopt tracer() Function we can set the drawing animation on or off by ourselves . When we want to draw the figure at one time , Without displaying the drawing process , You can choose to turn off the animation .

turtle.tracer(True) # Open drawing animation

turtle.tracer(False) # Turn off drawing animation

among ,“True” and “False” It refers to the opening and closing of drawing track animation respectively .

(4)delay() Function to set the drawing delay

adopt delay() Function to set the drawing delay for the current window screen , The unit is millisecond . The longer the drawing delay , The slower the drawing animation , Set to 0 You can avoid getting stuck .

turtle.delay(0) # Setting the background

among ,“0” It refers to the specific time of drawing delay on the canvas .

4、turtle Library common functions of brush motion

turtle There are many functions about brush motion in the library , We only use some of them , In programming , May adopt “turtle. Function name ()” To realize the function .Tips : The functions here come from Turtle Methods in class .

(1)forward() The function controls the brush to move forward by a specified distance

adopt forward() Function, we can move the brush forward , Then draw lines .

turtle.forward(100) # Move forward 100 Pixels

among ,“100” It refers to the specific pixel value , The length of the line can be changed by changing the pixel value . similarly , We can also pass “backward()” Function to move the brush backward to draw lines .

(2)left() Function controls the brush to rotate to the left by a specified angle

The initial orientation of the brush is to the right , We can left() Function to change the orientation of the brush .

turtle.left(90) # Turn left 90 degree

among ,“90” It refers to the specific angle value , The orientation can be changed by changing the angle value . similarly , We can also pass “right()” Function to rotate the brush to the right .

(3)goto() The function controls the brush to move to the specified coordinate position

turtle.goto(110,120) # Move to (110,120) Coordinate position

among ,“110” It refers to the abscissa of the position to be moved ,“120” It refers to the corresponding ordinate , You can change the position moved by changing the abscissa and ordinate . similarly , We can also pass “set(x)” and “set(y)” Two functions to set the horizontal and vertical coordinates of the turtle brush separately .

(4)speed() Function to set the speed at which the brush moves

The moving speed of the brush , It can be done by 0-10 Set the integer value within the range .

“ The fastest ”:0

“ Fast ”:10

“ normal ”:6

“ slow ”:3

“ The slowest ”:1

from 1 To 10 The speed of makes the animation of line drawing and turning faster and faster . Speed = 0 Indicates no animation . Forward / The effect of jumping when retreating , When turning left and right, it shows the effect of immediate turning .

turtle.speed(0) # Set the brush movement speed to the fastest

(5)clone() Function to clone a brush object

After generating a brush object , We can clone() Function to clone the object .

tt = turtle.Turtle(shape =“turtle”) # Instantiation Turtle class , Create objects , In the shape of a turtle

star = tt.clone() # clone

here , We manually created a brush object in the shape of a turtle , After through clone() Function to clone it , And stored in a variable star in .

Tips:turtle Brush objects in the library exist by default , And in the shape of a turtle , When we need to generate some extra brushes and set their shapes , Can be instantiated Turtle Class , Above .

5、turtle Common functions of Library brush control

turtle There are many functions about brush control in the library , We only use some of them , In programming , May adopt “turtle. Function name ()” To realize the function .

(1)shape() The function displays the shape

adopt shape() Function, we can make the brush display in various shapes , Like a turtle (turtle)、 circular (circle)、 Arrowhead (arrow) etc. , These are turtle Library shape list comes with , Of course , We can also manually draw the graphics into the shape list and then display them .

turtle.shape(“turtle”) # Show turtle shape

among ,“turtle” It refers to the specific shape of the turtle , You can change the actual shape by changing the parameters in the quotation marks .

Tips: We can “getshape()” Function to get turtle All shapes in the library shape list .

(2)register_shape() Function register shape

adopt register_shape() Function we can register shapes , Add non built-in graphics to the shape list .

turtle.register_shape(“tt”,shape) # Show turtle shape

among ,“tt” Refers to the name of the shape to be added to the list ,“shape” It refers to the specific shape to be added .

(3)begin_poly()、end_poly()、get_poly() The function records the shape

To store the drawing as a shape in the shape list , We need to record the vertices of the drawn graph . When programming , We need to go through... Before we start drawing “begin_poly()” Function to start the recording of vertices , Then, after the drawing is completed, pass “end_poly()” To end the record , Last , Re pass “get_poly()” Function to return the graph that gets the record .

turtle.begin_poly() # Start recording polygon vertices

for i in range(5): # Cycle five times

turtle.forward(15) # Forward 15 Pixels
turtle.right(144) # Turn right 144 degree

turtle.end_poly() # End record

shape = turtle.get_poly() # Return the recorded polygon

turtle.register_shape(“tt”,shape) # Add the drawn polygon to the shape list

here , We go through “begin_poly()”、“end_poly()”、“get_poly()” The three functions realize the recording of the vertices of the drawn Pentagram , And save the pentagram as the basic shape , Stored in the shape list .

(4)hideturtle() Function to hide the brush

shape() Function to make the brush display various shapes , And when we don't want to see it , We can “hideturtle()” Function to hide .

turtle.hideturtle() # Hide turtle brush

similarly , We can also go through “showturtle()” Function to make the brush appear again .

(5)penup() Function raises the brush

penup() Function to raise the brush , So that no graphics are drawn when moving .

turtle.penup() # Lift up the brush.

similarly , If we need to draw graphics as the brush moves , It can be done by “pendown()” Let the brush fall .

(6)pencolor() Function to set the color of the brush

When you move the brush to draw, the default color is black ,pencolor() Function to set the color of the brush , Then change the color of the drawn figure .

turtle.pencolor(“red”) # Set the brush color to red

among ,“red” It refers to the specific color , The color here can also be through RGB value 、 Hexadecimal value 、 Fixed values are expressed in three different ways .

(7)fillcolor()、begin_fill()、end_fill() Function to fill the graph color

pencolor() Function can only set the color of the brush , If you want to add a fill color to the drawing , We need to get through “fillcolor()” Function to set the color to fill , Then pass... Before starting drawing “begin_fill()” Function to start padding , Finally, after the drawing is completed, pass “end_fill()” Function to end the filling .

turtle.fillcolor(“red”) # Set the fill color to red

turtle.begin_fill() # Start recording polygon vertices

for i in range(5): # Cycle five times

turtle.forward(15) # Forward 15 Pixels
turtle.right(144) # Turn right 144 degree

turtle.end_fill() # End record

here , We go through “fillcolor()”、“begin_fill()”、“end_fill()” The three functions realize the red filling of the drawn Pentagram .

(8)xcor()、ycor() Function to get the horizontal and vertical coordinates of the brush

For the current coordinate position of the brush , We can “xcor()”、“ycor()” Function to detect .

x = turtle.xcor() # Detect the abscissa of the position of the brush

y = turtle.ycor() # Detect the ordinate of the position of the brush

among ,“x” and “y” There are two variables , Used to store the current abscissa and ordinate position of the detected brush .

(9)done() Function to end the drawing and keep the window

After the drawing is finished , We can done() Function to end the drawing , And keep the drawing window .

turtle.done() # Finish drawing , Keep the window open

here ,done() The use of the function must be the last sentence of the turtle graphics program .

Hands-on practice

Task description 1: Draw a star

Will pass through turtle A star drawn by the library is displayed on the screen .

1、 Hardware construction

adopt USB The connecting line connects the blank board to the computer

2、 Programming

STEP1: Create and save project files

start-up Mind+, Save the project as and name it “004、 Simulated starry sky ”.

STEP2: Create and save Python file

Create a Python Program files “main1.py”, Double-click to open .

STEP3: Import image

Import the background image in the project folder .( The picture and program file are in the project folder )( See the appendix for the picture download link 1)

STEP4: Programming

(1) Import the required libraries

In this task , We need to use turtle Library to draw stars , therefore , We have to import it first .

import turtle # Import turtle drawing library

(2) Create a drawing window

In order to keep the screen of the blank board consistent with the canvas when drawing , We need to manually create a fixed size canvas as the drawing window , And import a background image , Then set the painting delay .

Create a drawing window

width,height = 240,320 # Set the width and height of the window

turtle.setup(width,height) # Create a window with a set width and height

turtle.bgpic(‘ The vast galaxy .png’) # Add galactic background

turtle.delay(8) # Set painting delay ( In Milliseconds ), The longer the drawing delay , The slower the animation

(3) Create a brush and set drawing parameters

after , We created a turtle brush , And hide it , Make it not show when drawing , Then set its moving speed 、 Brush color 、 Fill color and other drawing related parameters .

Create a turtle brush and set relevant parameters

t = turtle.Turtle() # Instantiation Turtle class , Create a turtle object as a brush

t.hideturtle() # Hide turtle brush

t.speed(0) # Set the movement speed of the turtle brush

t.pencolor(“white”) # Set brush color

t.fillcolor(“white”) # Set fill color

(4) Draw a star

Next , We can draw the stars as we like , The specific steps are as follows .

t.pendown() # Set pen to paper , Draw as the brush moves

t.begin_fill() # Start filling

Drawing process

for i in range(5): # Cycle five times

t.forward(30) # Forward 30 Pixels
t.right(144) # Turn right 144 degree

t.end_fill() # End of filling

t.penup() # Lift up the brush.

turtle.done() # Finish drawing

Tips: The complete sample program is as follows :

Slide up to read

Draw a little star

import turtle # Import turtle Library

Create a drawing window

width,height = 240,320 # Set the width and height of the window

turtle.setup(width,height) # Create a window with a set width and height

turtle.bgpic(‘ The vast galaxy .png’) # Add galactic background

turtle.delay(8) # Set painting delay ( In Milliseconds ), The longer the drawing delay , The slower the animation , Set to 0 Avoid caton

Create a turtle brush and set relevant parameters

t = turtle.Turtle() # Instantiation Turtle class , Create a turtle object as a brush

t.hideturtle() # Hide turtle brush

t.speed(0) # Set the movement speed of the turtle brush

t.pencolor(“white”) # Set brush color

t.fillcolor(“white”) # Set fill color

t.pendown() # Set pen to paper , Draw as the brush moves

t.begin_fill() # Start filling

draw xingxing The process

for i in range(5): # Cycle five times

t.forward(30) # Forward 30 Pixels
t.right(144) # Turn right 144 degree

t.end_fill() # End of filling

t.penup() # Lift up the brush.

turtle.done() # Finish drawing

3、 The program runs

STEP1: Remote connection line blank board

STEP2: Click the run button at the top right

STEP3: Observe the effect

Observe the empty board , First, you can see a vast background of the Milky way , after , A white five pointed star gradually appears in the middle of the screen .

 Observation on the effect of XingKong board on starry sky

Task description 2: Draw the starry sky

Draw a star after success , We will use this method , Quickly draw multiple stars repeatedly at any position on the screen .

1、 Programming

STEP1: Create and save project files

Create a new one Python Program files “main2.py”, Double-click to open .

STEP2: Programming

(1) Import the required libraries

here , Because it will make stars appear randomly , therefore , We need additional import random Random number library .

import turtle # Import turtle Library

import random # Import random number dandom library

(2) Create a drawing window

Create a drawing window

width,height = 240,320 # Set the width and height of the window

turtle.setup(width,height) # Create a window with a set width and height

turtle.bgpic(‘ The vast galaxy .png’) # Add galactic background

turtle.delay(8) # Painting delay , Set to 0 Avoid caton

(3) establish Star class

here , We create a star class and re instantiate it to draw multiple stars successively at random positions to show the effect of random appearance of stars . Sort it out , Let's first set the basic properties of the brush , Then draw a single star , Finally, repeat the same process 10 Realize the drawing of the starry sky for the first time . therefore , In the constructor , Let's set the turtle brush first , Keep it hidden , And move the fastest , Then call the subsequent instance method of drawing star sky to realize the requirements .

Define a Star class

class Star(turtle.Turtle):

def __init__(self):
turtle.Turtle.__init__(self) # Unbundling Star Methods in class , Make it own Turtle Methods in class
self.hideturtle() # Hide turtle brush
self.speed(0) # Set the brush speed
self.draw_stars() # Draw the whole starry sky

(4) Draw a single star

after , Let's create an instance method , Draw a single star , The specific process is as follows .

def draw_star(self): # Draw a star

 self.pencolor("white") # Set brush color
self.fillcolor("white") # Set fill color
self.pendown() # Set pen to paper , Draw as the brush moves
self.begin_fill() # Start filling
# Drawing process
for i in range(5): # Cycle five times
self.forward(20) # Forward 20 Pixels
self.right(144) # Turn right 144 degree
self.end_fill() # End of filling
self.penup() # Lift up the brush.

(5) Draw the starry sky

next , We then create an instance method to draw ten stars and make them appear randomly on the screen , The specific process is as follows .

def draw_stars(self): # Draw the whole starry sky

 self.penup() # Lift up the brush.
# Drawing process
for i in range(10): # loop 10 Time , draw 10 star
x=random.randint(-120,120) # Set random... In the screen x coordinate
y=random.randint(-160,160) # Set random... In the screen y coordinate
self.goto(x, y) # Go to the initial position
self.draw_star() # Draw a single little star
self.end_fill() # End of filling
self.penup() # Lift up the brush.

(6) Instantiation Star class , And end the drawing

Last , We use instantiation Star class , To create a complete starry sky .

Star() # establish Star Class

turtle.done() # Finish drawing , Keep the window open

Tips: The complete sample program is as follows :

Slide up to read

Draw little stars , And make it appear randomly

import turtle # Import turtle Library

import random # Import random number dandom library

Create a drawing window

width,height = 240,320 # Set the width and height of the window

turtle.setup(width,height) # Create a window with a set width and height

turtle.bgpic(‘ The vast galaxy .png’) # Add galactic background

turtle.delay(0) # Painting delay , Set to 0 Avoid caton

Define a Star class

class Star(turtle.Turtle):

def __init__(self):
turtle.Turtle.__init__(self) # Unbundling Star Methods in class , Make it own Turtle Methods in class
self.hideturtle() # Hide turtle brush
self.speed(0) # Set the brush speed
self.draw_stars() # Draw the whole starry sky
def draw_star(self): # Draw a star
self.pencolor("white") # Set brush color
self.fillcolor("white") # Set fill color
self.pendown() # Set pen to paper , Draw as the brush moves
self.begin_fill() # Start filling
# Drawing process
for i in range(5): # Cycle five times
self.forward(20) # Forward 20 Pixels
self.right(144) # Turn right 144 degree
self.end_fill() # End of filling
self.penup() # Lift up the brush.
def draw_stars(self): # Draw the whole starry sky
self.penup() # Lift up the brush.
# Drawing process
for i in range(10): # loop 10 Time , draw 10 star
x=random.randint(-120,120) # Set random... In the screen x coordinate
y=random.randint(-160,160) # Set random... In the screen y coordinate
self.goto(x, y) # Go to the initial position
self.draw_star() # Draw a single little star
self.end_fill() # End of filling
self.penup() # Lift up the brush.

Star() # establish Star Class

turtle.done() # Finish drawing , Keep the window open

2、 The program runs

STEP1: Remote connection line blank board

STEP2: Run the program and observe the effect

When I hit run , Observe the empty board , You can see small stars randomly appear on the screen .
 Effect drawing of empty board operation

Task description 3: Simulate the dynamic starry sky

Next , We'll make stars appear randomly at the top of the screen , Then it slowly falls down , Simulate a dynamic starry sky .

1、 Programming

STEP1: Create and save project files

Create a new one Python Program files “main3.py”, Double-click to open .

STEP2: Programming

(1) Import the required libraries

import turtle # Import turtle library

import random # Import random number dandom library

(2) Create a drawing window

Create a drawing window

width,height = 240,320 # Set the width and height of the window

turtle.setup(width,height) # Create a window with a set width and height

turtle.bgpic(‘ The vast galaxy .png’) # Add galactic background

turtle.delay(0) # Painting delay , Set to 0 Avoid caton

(3) Draw stars and record their outlines

In the last task , We quickly drew on the screen 10 A star , And in here, , We want to make the stars float randomly , They must be regarded as independent objects , Therefore, we need to record the outline of the drawn stars , So that you can add it as a star shape to turtle The library is in the default shape list , Then make the stars appear in the form of brush objects .

Draw stars and record their outlines

t = turtle.Turtle() # Instantiation Turtle class , Create a turtle object as a brush

t.hideturtle() # Hide turtle brush

t.speed(0) # Set the fastest moving speed

t.pencolor(“white”) # Set brush color

t.fillcolor(“white”) # Set fill color

t.penup() # Lift up the brush.

t.goto(-140,0) # Move to the left side of the screen

turtle.tracer(False) # Turn off animation

t.begin_fill() # Start filling

t.begin_poly() # Start recording polygon vertices

for i in range(5): # Cycle five times

t.forward(15) # Forward 15 Pixels
t.right(144) # Turn right 144 degree

t.end_poly() # End record

t.end_fill() # End of filling

(4) Get the recorded star outline and add it to the shape list

Next , We can draw the stars as we like , The specific steps are as follows .

Get the recorded star outline and add it to the shape list

shape = t.get_poly() # Return the recorded polygon

turtle.register_shape(“tt”,shape) # Add the drawn polygon to the shape list , Name it tt

(5) Draw a star

after , We can call the star shape as a brush object .

turtle.tracer(True) # Open animation

Create stars

tt = turtle.Turtle(shape=‘tt’) # Instantiation Turtle class , Create an object brush , The shape is five pointed star , And assign to variable tt, It's all in the back tt To express

tt.pencolor(“white”) # Set brush color

tt.fillcolor(“white”) # Set fill color

tt.penup() # pen-up

tt.goto(-120,160) # Move off screen

(6) Clone stars and make them appear randomly at the top of the screen

Then , We clone 50 Star brush object , And make it appear randomly at the top of the screen .

stars = [] # Create a star list

for s in range(50): # Conduct 50 Secondary cycle

star = tt.clone() # Clone stars
s =random.random()/3 # random number
star.speed(int(s*10)) # Movement speed
star.setx(random.randint(-width/2,width/2)) # Set the star x The coordinates are on the screen

star.sety(height/2+ random.randint(1,height)) # Set the star y The coordinates are at the top of the screen

star.showturtle() # Show stars
stars.append(star) # Expand the stars

(7) Simulated starry sky , Make the stars fall randomly

Last , We let it fall slowly .

while True: # Permanent cycle

for star in stars: # List loop
star.sety(star.ycor() - 3 * star.speed()) # Set the vertical movement of the stars
if star.ycor()<-300: # Judge whether the stars have moved to the bottom of the screen
star.hideturtle() # Hidden stars
star.setx(random.randint(-width/2,width/2)) # Set the star x The coordinates are on the screen
star.sety(height/2+ random.randint(1,height)) # Set the star y The coordinates are at the top of the screen
star.showturtle() # Show stars

Tips: The complete sample program is as follows :

Slide up to read

Floating from top to bottom

import turtle # Import turtle library

import random # Import random number dandom library

Create a drawing window

width,height = 240,320 # Set the width and height of the window

turtle.setup(width,height) # Create a window with a set width and height

turtle.bgpic(‘ The vast galaxy .png’) # Add galactic background

turtle.delay(0) # Painting delay , Set to 0 Avoid caton

Draw stars and record their outlines

t = turtle.Turtle() # Instantiation Turtle class , Create a turtle object as a brush

t.hideturtle() # Hide turtle brush

t.speed(0) # Set the fastest moving speed

t.pencolor(“white”) # Set brush color

t.fillcolor(“white”) # Set fill color

t.penup() # Lift up the brush.

t.goto(-140,0) # Move off screen

turtle.tracer(False) # Turn off animation

t.begin_fill() # Start filling

t.begin_poly() # Start recording polygon vertices

for i in range(5): # Cycle five times

t.forward(15) # Forward 15 Pixels
t.right(144) # Turn right 144 degree

t.end_poly() # End record

t.end_fill() # End of filling

Get the recorded star outline and add it to the shape list

shape = t.get_poly() # Return the recorded polygon

turtle.register_shape(“tt”,shape) # Add the drawn polygon to the shape list , Name it tt

print(turtle.getshapes())

turtle.tracer(True) # Open animation

Create stars

tt = turtle.Turtle(shape=‘tt’) # Instantiation Turtle class , Create an object brush , The shape is five pointed star , And assign to variable tt, It's all in the back tt To express

tt.pencolor(“white”) # Set brush color

tt.fillcolor(“white”) # Set fill color

tt.penup() # pen-up

tt.goto(-120,160) # Move off screen

stars = [] # Create a star list

for s in range(50): # Conduct 50 Secondary cycle

star = tt.clone() # Clone stars
s =random.random()/3 # random number
star.speed(int(s*10)) # Movement speed
star.setx(random.randint(-width/2,width/2)) # Set the star x The coordinates are on the screen
star.sety(height/2+ random.randint(1,height)) # Set the star y The coordinates are at the top of the screen
star.showturtle() # Show stars
stars.append(star) # Expand stars into the list

while True: # Permanent cycle

for star in stars: # List loop
star.sety(star.ycor() - 3 * star.speed()) # Set the vertical movement of the stars
if star.ycor()<-300: # Judge whether the stars have moved to the bottom of the screen
star.hideturtle() # Hidden stars
star.setx(random.randint(-width/2,width/2)) # Set the star x The coordinates are on the screen
star.sety(height/2+ random.randint(1,height)) # Set the star y The coordinates are at the top of the screen
star.showturtle() # Show stars

2、 The program runs

STEP1: Remote connection line blank board

STEP2: Run the program and observe the effect

When I hit run , Observe the empty board , You can find that after waiting a few seconds , Small white stars fell randomly from the top of the screen , With the Milky way .

 The line blank board program runs

Challenge yourself

Try to change the shape of the stars 、 size 、 Quantity and color , Take a look at the changed 3D How about the effect of the starry sky !
Want to learn more blank boards Python Series of introductory tutorials, please pay attention to “ Mushroom clouds create ”.

版权声明:本文为[Playful maker]所创,转载请带上原文链接,感谢。 https://pythonmana.com/2022/134/202205141527527022.html