Imported art pieces: build scenes from ready-made shapes
You don't redraw a star every time. You import it once and reuse it. Those ready-made pieces are the building blocks for a whole scene.
The big idea
Imported shapes are reusable pieces you combine to build a bigger picture.
See it in code
You don't draw a star from scratch. You import it once, then use it. Here we import star and place it a single time:
from art import Canvas, star
screen = Canvas.create()
Canvas.fill(screen)
star(screen, 250, 250, size=100)
The star was ready-made. We imported it, then just chose where it goes.
Import a second piece and combine them. Now we have star and flower — two ready-made shapes in one picture:
from art import Canvas, star, flower
screen = Canvas.create()
Canvas.fill(screen)
star(screen, 170, 220, size=90)
flower(screen, 320, 320, size=90)
Each piece was imported once. Adding more just means more import names — and more to arrange.
Now build a whole scene from those two pieces. Flowers along the bottom. A big star like a sun. Small stars twinkling above:
from art import Canvas, star, flower
screen = Canvas.create()
Canvas.fill(screen)
flower(screen, 150, 380, size=90)
flower(screen, 350, 380, size=90)
star(screen, 250, 130, size=100)
star(screen, 110, 190, size=40)
star(screen, 390, 190, size=40)
Two shapes, five spots, one scene. The pieces are imported and ready. So you spend your time arranging — the fun part — not redrawing.
Real projects are built from reusable pieces. A game reuses a coin. A website reuses a button. A comic reuses a character. Make a good piece once, then use it again and again.
Try it yourself
Add three more small stars to fill the sky. Then add a flower in the center — does the scene feel fuller, or too busy?
The common mistake
Trying to use a piece you didn't import. You can only place star and flower if they're on your from art import ... line. Import the pieces you want first, then compose.
What it unlocks
Composing pieces builds on imports and pygame drawing, and rewards good composition.