I decided to move this release to 2.0 (instead of 1.11, which is what it was originally going to be), due to it breaking backwards compatibility. 408 more words
Tags » Python
Using the module turtle and Python3. The following program will generate (roughly) the Vietnamese flag.
import turtle wn = turtle.Screen() # Set up the window and its attributes wn.bgcolor("red") # Background color of the screen screen_width = 750; # Width of the screen screen_height = 500; # Height of the screen star_length = 200; # Length of one side of the star wn.setup(width = screen_width, height = screen_height) wn.title("Flag of Vietnam") vin = turtle.Turtle() vin.color("red") # Set the color of the turtle to red # Move the turtle to a predefined coordinate vin.setx((screen_width - star_length)/2 - screen_width/2) vin.sety(star_length/4) vin.color("yellow") vin.shape("blank") # Hide the shape of the turtle vin.pensize(3) # Pen size of the turtle # Draw the flag for counter in range(5): vin.forward(star_length) vin.right(144) wn.exitonclick()