Lists with JPG Images

Lists with JPG Images Lesson Plan

Lists with JPG Images

Students format and upload JPG images to the CodeX, then display them from a list.

⏰ 45 min 🎯 Grades 9-12 💻 CodeSpace 🎮 CodeX 🐍 Python
View Lesson Outline
📋

Overview

This is an optional lesson, but it is highly engaging because it allows for self expression. Students find their own JPG images, format them for the CodeX, and upload them to the CodeX file system. Then they write the Picture_Bot program, which stores the image file names in a list and displays the images on the CodeX screen.

There is no activity guide for this lesson. Students complete a programming project. They can make a slide show, like Mission 7, or display random JPG images, like Mission 8, or do both.

🎯 Mission Goal: Students will display JPG images on the CodeX display screen from a list.

🎯

Learning Targets

  • I can format a JPG image for use on the CodeX.
  • I can upload a JPG file to the CodeX.
  • I can define a list of JPG images.
  • I can display a JPG image from a list.
💡

Key Concepts

  • In order for a JPG image to display on the CodeX display screen, it must be formatted correctly.
  • Images uploaded to the CodeX are only available on that CodeX. They are saved on the CodeX file system, not in the cloud.
✅

Assessment Opportunities

  • Picture_Bot program, or another program that displays JPG images.
☑️

Success Criteria

  • Format a JPG image to display on the CodeX
  • Define a list of JPG images
  • Display a JPG image from a list
📁

Digital Resources

🧰

Classroom Materials

  • ▸CodeX (students need to use the same CodeX each time to access their uploaded images)
  • ▸USB-C cable
  • ▸JPG images saved on a flash drive or computer, not in the cloud
🌍

Real-World Applications

Real-world lists are practical tools used everywhere to organize tasks, track information, and manage data efficiently.

✅To-do lists: People use these to manage daily tasks, work assignments, and household chores.
🛒Shopping lists: Shoppers write down items they need to buy before going to the store to save time and prevent forgotten items.
🎵Playlists: Music services arrange songs in a specific order so users can play their favorites back-to-back. The playlist can change from day to day.
🚀

Extensions & Cross-Curricular

ExtensionStudents build both versions of the program: a slide show that scrolls through the list with button presses, like Mission 7, and a random image display, like Mission 8.
ExtensionStudents add more images to the list and test that every new file name displays correctly.
MathStudents find the new width and height for a rectangular image so the longest side is 240 pixels and the proportions stay the same.
Lang ArtsStudents write a short caption for each image, and a comment in their code that credits the source of each image.
🐍

New Python Code

▾
display.draw_jpg("pics/goldfish.jpg")Display a JPG image on the display screen
display.draw_jpg(my_images[index])Display a JPG image from a specific index in a list
display.draw_jpg(random.choice(my_images))Display a random JPG image from a list
📐

Standards

▾

CSTA Standards - Grades 9-10

3A-CS-01 3A-AP-14

CSTA Standards - Grades 11-12

3B-AP-12

AP CSP Framework

AAP-1.C - Represent a list or string using a variable.
Computational Thinking Practice 3.A - Generalize data sources through variables.
📝
Preparing for the Lesson
  • Decide whether to teach from the slides or hand out the CodeX and JPG Images One Pager or the JPG Images Tutorial (PDF). Both go over the same steps and can be given to students.
  • Students need their JPG images saved on a flash drive or computer, not in the cloud. They can find images on the Internet, use pictures they took with a cell phone, or scan photos.

🧑‍🏫
Teacher Notes
  • This is an optional lesson, but it is highly engaging because it allows for self expression.
  • There is no activity guide for this lesson. Students complete a programming project.
  • It is a good idea to check each image on the CodeX as it is being formatted. If an image does not display on the screen, the number one reason is formatting. You will not get an error message, the JPG just will not show.
  • We highly recommend using Photopea and following the directions. It works every time. Make sure you change the DPI (if needed) before you change the width and height.
  • The image does not have to be square to display on the screen. However, if you want to ensure the image is square, use the "Canvas Size" setting first.
  • You can use other photo editing software, but you may need to experiment to get the correct settings.
🗺️

Lesson Outline

🗣️Warm-up

Go over slides 2-3.

Discuss JPG images. Compare and contrast them to bitmap images.

Teaching tip: If your students are ready to start right away, you can skip the warm-up.
🖼️Activity - Prepare Images

Slide 4: Students find images to display on the CodeX. They can find images from the Internet, use pictures they took with a cell phone, or scan photos. They should be saved on a flash drive or computer and not in the cloud.

Teaching tip: The slide says the image should already be a JPG. It can be in a different format and then saved as a JPG.

Slide 5: Explain that all images need to be formatted for display on the CodeX.

Slides 6-11: Students format their images for the CodeX.

Teaching tip: You can follow the slides, or use one of the handouts. Both go over the steps and can be given to students: CodeX and JPG Images One Pager and JPG Images Tutorial (PDF).

Slides 12-15: Students upload their images to the CodeX.

Teaching tip: You can follow the slides, or use one of the handouts. Both go over the steps and can be given to students. There is also a YouTube video demonstration.
Teaching tip: Students can choose to create a folder for the images, or just upload to the memory. Creating a folder keeps all the files organized, but it is not necessary. Either way, they need to type the file path correctly in the code.
💻Activity - Program with the Images

Slides 15-21: Students start a new program. They create a list of images and then display them.

Teaching tip: The slides walk students through testing each image first to make sure they are formatted correctly and will display.
Teaching tip: The handouts have shortened instructions for displaying JPG images on the CodeX. They can be used for reference.
🧑‍🤝‍🧑Wrap-Up

✅ The JPG images program is complete and ready to turn in.

Formative assessment:

  • Daily reflection journal
  • Class discussion on what they learned about lists
  • Exit ticket