With python print out of love

In fact, if the programmer really romantic, ordinary people do not understand, science and technology thrive, you may be shocked! ! ! ! !

Today, Taytay gave you bring a "programmer technology (romantic) performance of" tutorial. Flying Whale taps have hope that it will help you in this July eve. If a success, remember to send a congratulatory message Taytay. Oh, lover would like to get married!

Before you look down, you can also see Taytay early course "expression of love": python with a special painting for her heart.

You make my heart up.

Today, we still use "heart" to express, but the "heart" is not another "heart", we bring today it is a "dynamic heart, to show those secrets in your heart, then!"

In the day of Tanabata, depicting a love for your favorite object, the expression "your mind the idea of" what kind of complexity?

Well, take a look at the effect of:

heart disease

Create a love of your heart

Take a look at the above results, it is the heartbeat? Now, Taytay will tell you how to build this "love your heart."

(1) install the development environment

The "love" is based on the python language, so there is no installation python environment, install the environment.

Installation can refer to: python 3 development environment constructed course, also you need to install after installation: pycharm-ide.

If you want to register PyCharm, you can see: PyCharm Professional (Professional editing) crack tutorial and permanently activate it.

(2) encoding

Here we talk about the process of writing directly to the code, comments detailed written you a little modification, you can become your own style implementer.


Damn! / usr / bin / Python the env
# - * - encoding: UTF-8 - * -

Turtles import
lead-in time

# Draw a heart-shaped arc
defined hart_arc ():
for the range (200) of the i:
Turtle. Right (1)
turtle. Forward (2)

Defined movement of the pen position (x, y):
Turtle. Turtle () hidden brush (first)
turtle. Up () pen
turtle. To (x, y) to move the pen to the designated start coordinates (0,0 window center)
turtle. Down () to write
the turtle. ShowTurtle () displays brushes


love = input ( "Please enter a statement, the default is' I love you ':')
Signature = the INPUT (" Please sign your name, do not fill not displayed by default: ")

If you love = '':
Love = I love you

# Initialize
turtle. Setting (width = 800, height = 500) window (canvas) size
turtle. Color ( "red", "pink") brush color
turtle. Pressure (3) The thickness of the brush
turtle. Speed (1) Description Speed
# initialization start coordinate pen
moves the pen position (X = 0, Y = -180 ) moving the brush position
turtle. Left (140) is rotated 140 degrees

tortoise. begin_fill () mark positions background fill

# Draw a straight line shape of one mind (lower left)
turtle. Move the brush, a length of 224 forwards (224) forwardly
# love draw a circle
hart_arc () left arc
turtle. Left (120) to adjust the angle of the brush
hart_arc () Right arc
# Videos one heart-shaped straight line (bottom right)
turtle. Forward (224)

tortoise. end_fill () marks the end of the background fill

# Intention to write to the word expressive
mobile predicate position (0,0)
turtle. Turtle () hidden brush
tortoise. Color ( "CD5C5C", "pink"), font color
# Font: Set Font, (all available fonts on the computer) Size align: center aligned
turtle. Write (love, font = ( 'arial ', 30, 'bold'), align = "center")

# Signature
If the signature! =:
Turtle. Color (red, pink)
time. Sleep (2)
move "pen" position (180, -180)
turtle. Turtle () hidden brush
tortoise. Written (signature font = ( 'Arial', 20) , Align = "Center")

# Click the Close Program window
window = turtle. Screen ()
window. Exit Click ()

Damn! / usr / bin / Python the env
# - * - encoding: UTF-8 - * -

Turtles import
lead-in time

# Draw a heart-shaped arc
defined hart_arc ():
for the range (200) of the i:
Turtle. Right (1)
turtle. Forward (2)

Defined movement of the pen position (x, y):
Turtle. Turtle () hidden brush (first)
turtle. Up () pen
turtle. To (x, y) to move the pen to the designated start coordinates (0,0 window center)
turtle. Down () to write
the turtle. ShowTurtle () displays brushes


love = input ( "Please enter a statement, the default is' I love you ':')
Signature = the INPUT (" Please sign your name, do not fill not displayed by default: ")

If you love = '':
Love = I love you

# Initialize
turtle. Setting (width = 800, height = 500) window (canvas) size
turtle. Color ( "red", "pink") brush color
turtle. Pressure (3) The thickness of the brush
turtle. Speed (1) Description Speed
# initialization start coordinate pen
moves the pen position (X = 0, Y = -180 ) moving the brush position
turtle. Left (140) is rotated 140 degrees

tortoise. begin_fill () mark positions background fill

# Draw a straight line shape of one mind (lower left)
turtle. Move the brush, a length of 224 forwards (224) forwardly
# love draw a circle
hart_arc () left arc
turtle. Left (120) to adjust the angle of the brush
hart_arc () Right arc
# Videos one heart-shaped straight line (bottom right)
T

Guess you like

Origin www.cnblogs.com/blogst/p/11404430.html