.. _lab-02:
Lab 2: Draw a Picture
=====================
Your assignment: Draw a picture.
The goal:
* Practice looking up API documentation - useful for using any code library
* Practice calling functions - a basic building block of all computer programs
* Practice working with RGB colors - used in graphics, web design, and even LED lighting
* Practice commenting and formatting code properly - required to make code maintainable
* Practice working with graphics coordinates - also used in document layout and web design
Requirements
------------
To get full credit:
* Use the same project and repository that you used for Lab 01.
If you forked your repository from mine, you should already have a folder
for lab 2. Use that folder, and the ``lab_02.py`` file inside. Otherwise create one.
* Use several different colors.
* Make a coherent picture.
Don't make abstract art with random shapes, because that doesn't require a full
application of what we've learned to a real use-case.
* Use multiple types of graphic functions. Include
circles, ellipses, rectangles, lines, polygons and more in your drawing.
It is certainly
possible to make great art with just squares, but the point of the lab is to
practice using multiple functions.
* Use a single blank line in your code to break up logical sections.
For example, when drawing
a tree, put a blank line ahead of, and after. See the example code below.
* Use comments effectively. For example, when drawing a tree, put a comment at
the start of those drawing commands that says ``# Draw a tree``. Remember
to put one space after the ``#`` sign.
* Put spaces after commas for proper "style."
* Use PyCharm to inspect your code for warnings. Fix warnings that you encounter.
Tips
----
To select new colors use: https://www.google.com/search?q=color+picker
Copy the values for Red, Green, and Blue from the color picker.
Do not worry about colors for hue, saturation, or brilliance.
Keep in mind the order of code. Shapes drawn first will be at the "back."
Shapes drawn later will be drawn on top of the other shapes.
Also, remember you can look up the available commands, called the "API" at:
https://arcade.academy
Example Lab
-----------
.. image:: final_program.png
.. literalinclude:: final_program.py
:language: python
:linenos:
Other Examples
--------------
Here are some images from prior years:
.. raw:: html