Now, let's write our Python code in main.py
! You'll be working inside the draw_landmark_A
function. Remember, we want to draw a filled circle at a specific spot with a certain color.
Here are some helpful code examples:
1. How to make a function that takes information:
def draw_shape(x_pos, y_pos, shape_color):
# Your drawing code goes here
print(f"Drawing a shape at ({x_pos}, {y_pos}) with color {shape_color}")
draw_shape(10, 20, "red")
2. Moving your pen without drawing:
import turtle
my_pen = turtle.Turtle()
my_pen.penup() # Lift the pen up (no drawing)
my_pen.goto(30, 40) # Move to a new spot
my_pen.pendown() # Put the pen down (ready to draw)
3. Setting color and filling shapes:
import turtle
my_pen = turtle.Turtle()
my_pen.color("green") # Set the color
my_pen.begin_fill() # Start filling
my_pen.circle(25) # Draw your shape (e.g., a circle)
my_pen.end_fill() # Stop filling and fill the shape
4. Drawing a circle:
import turtle
my_pen = turtle.Turtle()
my_pen.circle(50) # Draws a circle with radius 50
5. Lifting the pen after drawing:
import turtle
my_pen = turtle.Turtle()
# ... drawing code ...
my_pen.penup() # Lift the pen after you're done drawing