Instructions for turtleScene

(produced at 02:55 a.m. UTC on 2024-01-24)

This task is part of project01 which is due at 23:00 EST on 2024-01-30.

You have the option to work with a partner on this task if you wish. Working with a partner requires more work to coordinate schedules, but if you work together and make sure that you are both understanding the code you write, you will make progress faster and learn more.

You can download the starter code for this task using this link.

You can submit this task using this link.

Put all of your work for this task into the file scene.py
(you will create this file from scratch)

Note: You can view a video walkthrough of these instructions if you prefer to hear them explained instead of reading them yourself.

For this task, we want you to get some practice writing code at the most basic level, and also become familiar with the turtle and turtleBeads commands that can be used for drawing in Python.

The requirements are very simple, and in fact, there are no restrictions on what you draw: the only rules are that you must make use of certain functions.

To start, you need to create a new file, named scene.py. This file must be in a folder where turtleBeads.py is also present. To create that file, you should:

  1. Download the starter code for this task from Potluck.
  2. Unzip the downloaded file to create a folder to work in. This folder will include a file called turtleBeads.py.
  3. In Thonny, create a new file. Immediately use "save" or "save as" and then pick the folder you just created as the destination, with "scene.py" as the filename.

Now you're ready to write code. Your scene.py file must satisfy the following criteria:

  1. Your file must start with a triple-quoted string at the top, identifying the names of each author, which classmates and/or tutors and/or instructors you consulted for help, the last date you modified the file, and a brief description of the purpose of the file. We will do this for all files that you submit in this class. Here is an example:

    """
    Authors: Anon & Ymous
    Consulted: T. A.
    Date: 2022-9-8
    Purpose: Turtle Scene task
    """
    
  2. Your file must appropriately import the turtleBeads module. You will also need to import the turtle module separately to ensure that you can use the basic drawing commands.

  3. You must use each of the following basic movement functions (reference) at least once:
  4. You must use an absolute positioning command at least once (one of setx, sety, setpos/setposition/goto, or teleport).
  5. You must use each of the following turtleBeads shapes (turtleBeads reference):
  6. You must vary the thickness and colors of some lines, using both pensize and either pencolor or color (pen functions reference).
  7. You must use begin_fill and end_fill to draw at least one filled-in shape, and you must use fillcolor (or color)) to control its color (fill reference; see also the example on filling).
  8. You must use penup and pendown to move the turtle without drawing a line (or you may use the one or more of the teleport, leap, or hop functions from turtleBeads to achieve the same thing).
  9. You must use the title function to assign a title to your graphics window (title reference).

You are welcome to use other turtle or turtleBeads features in addition to the ones listed above, but only the above features are required.

If you want to challenge yourself and read ahead a little bit, consider defining a custom function and using it as part of your turtle scene (but you will not receive any extra credit for this, so don't do it if you're short on time).

Note: to speed up the drawing when things get complex, you can use the noTrace and showPicture functions. You can read how they work in our turtle documentation.

After completing this task, you must take a screenshot of your graphics scene, name it correctly, and upload it to the shared google drive folder as explained in the submission instructions.

Examples

Using turtle

Here's a brief reminder of how to use the turtle/turtleBeads drawing commands. This code draws a triangle by drawing a line and then turning three times.

In []:
from turtleBeads import * forward(200) left(120) fd(200) lt(120) fd(200) lt(120)
Prints
A 1-pensize black horizontal line from (0, 0) to (200, 0). A 1-pensize black 120° line from (200, 0) to (100, 173). A 1-pensize black 60° line from (100, 173) to (0, 0).
Image A thin black equilateral triangle on a white background; a small arrow at the lower-left corner pointing rightwards along the bottom edge indicates the final position and orientation of the 'turtle' which drew the triangle.

Filling a shape

Here's an example of how to use begin_fill and end_fill together to fill in a shape, along with a few other commands to customize things. Remember that a quick reference guide is available that covers all of the turtle and turtleBeads functions we will use in this class.

In []:
from turtleBeads import * pencolor("SkyBlue") pensize(3) fillcolor("HotPink") begin_fill() drawCircle(120) end_fill()
Prints
Start of filled shape. A 3-pensize SkyBlue circle centered at (0, 0) with radius 120 Filled in shape using HotPink.
Image A pink circle with a sky-blue border. A sky-blue arrow in the center of the circle pointing right indicates the position of the 'turtle' which drew the circle.

Rubric

Group goals:
 
unknown No errors loading code
Your code should be able to be loaded without errors. Run your code before submitting it to make sure this is true.
 
unknown Call forward
Call forward or fd in at least one place.
 
unknown Call backward
Call backward, bk, or back in at least one place.
 
unknown Call left
Call left or lt in at least one place.
 
unknown Call right
Call right or rt in at least one place.
 
unknown Call setpos
Call setpos, setposition, setPosition, goto, setx, setX, sety, setY, or teleport in at least one place.
 
unknown Call pensize
Call pensize or penSize in at least one place.
 
unknown Call pencolor
Call pencolor, color, or penColor in at least one place.
 
unknown Call fillcolor
Call fillcolor, color, or fillColor in at least one place.
 
unknown Call begin_fill
Call begin_fill or beginFill in at least one place.
 
unknown Call end_fill
Call end_fill or endFill in at least one place.
 
unknown Call drawCircle
Call drawCircle or circle in at least one place.
 
unknown Call drawRectangle
Call drawRectangle in at least one place.
 
unknown Call drawText
Call drawText or write in at least one place.
 
unknown Call penup
Call penup, pu, penUp, teleport, leap, or hop in at least one place.
 
unknown Call pendown
Call pendown, pd, penDown, teleport, leap, or hop in at least one place.
 
unknown Call title
Call title in at least one place.