Give the chores checklist a photo for each chore: tick a chore, then take a photo or choose one, and it appears beside that chore. A variable remembers which chore was ticked, and the photo event checks it.
Apps ask for proof all the time: a photo of the parcel at the door, the receipt, the finished job. The app has to know which job each photo belongs to.
The chores checklist from earlier has a tick box for each chore. Today each chore also gets a photo to show it's done: the made bed, the dog's bowl, the finished homework.
A Photo object takes a photo with the camera, or lets the user Choose a photo from the computer.
When a photo is taken (or chosen), the event A photo is taken with Camera runs, and Camera.picture is the photo.
The app has to know which chore the photo is for. A variable remembers the chore you ticked last.
Photos of things, not people. They stay in this browser: nothing is sent anywhere.
How this lesson works: See it, Build, Check, Make it yours
See it: Try the finished thing first, so you know what you are building.
Build: Watch the short clip, then do the steps. Your app carries on from the step before.
Check: A quick check that the idea has stuck.
Make it yours: Change your app on purpose, then try it on someone.
Make your prediction first. Help opens once you've locked it in.
See itTry the finished thing first, so you know what you are building.
Try the finished app
Tick Make my bed.
Click 🖼 Choose a photo and pick any photo on your computer, or tap the camera to start it and press the round button.
The photo appears beside Make my bed. Now tick another chore and add another photo.
No camera, or your school blocks it? Choose a photo works everywhere.
Try it yourselfYour edits are saved in this browser.
BuildWatch the short clip, then do the steps. Your app carries on from the step before.
Build 1: a Photo object
+ Add object, Photo. Rename it Camera and put it under the 🌙 Dark button (x 229, y 372).
In its Properties, tick Allow camera in this app. The browser will ask too.
Run it: tap the Photo to start the camera, or click Choose a photo.
We've made room beside each chore for its photo: BedPic, FeedPic and HomeworkPic. They're hidden until they have a photo.
A Photo object · Sound on for the voiceoverVoice:
Try it yourselfYour edits are saved in this browser.
A Photo object called Camera.
Run your program. This ticks when your code does all of the above.
BuildWatch the short clip, then do the steps. Your app carries on from the step before.
Build 2: remember which chore
Add a variable ForChore. Leave it empty.
Add an event: BedJob, BedJob is switched. It runs when the tick box is ticked or unticked.
From its ⋯ menu, Add a sub-event: BedJob, BedJob is on (it's just been ticked), with the action Set variable ForChore to "Bed".
Do the same for FeedJob ("Feed") and HomeworkJob ("Homework").
Run it and tick a chore. Watch ForChore on the left.
Why only when ticking, not unticking? A photo shows a chore is done.
Try it yourselfYour edits are saved in this browser.
A variable ForChore, set to "Bed", "Feed" or "Homework" when that chore is ticked.
Run your program. This ticks when your code does all of the above.
BuildWatch the short clip, then do the steps. Your app carries on from the step before.
Build 3: put the photo beside its chore
Add an event: Camera, A photo is taken with Camera.
From its ⋯ menu, Add a sub-event: Variables, Variable ForChore ="Bed", with two actions:
BedPic, Set BedPic picture to the one inCamera.picture
BedPic, Show BedPic
Add two more sub-events under the photo event, the same way, for "Feed" (FeedPic) and "Homework" (HomeworkPic).
Run it: tick a chore, add a photo, then another chore and another photo.
A photo event that checks which chore · Sound on for the voiceoverVoice:
Try it yourselfYour edits are saved in this browser.
When a photo is taken, the chore ForChore names shows it: BedPic for "Bed", FeedPic for "Feed", HomeworkPic for "Homework".
Run your program. This ticks when your code does all of the above.
CheckA quick check that the idea has stuck.
Check: which chore gets it?
Watch ForChore on the left as you try it.
Nib set ForChore when ticking, just like you.
Every photo Nib adds appears beside Make my bed, whichever chore was ticked. Click the line where Nib goes wrong.
Make it yoursChange your app on purpose, then try it on someone.
Make it yours: untick hides the photo
When a chore is unticked, its photo should go too. Select each is on sub-event, choose ⋯, Add an Else below (it runs when the chore is unticked), and give it Hide BedPic (or FeedPic, HomeworkPic). A new photo shows it again.
More ideas: a Take a photo button of your own (untick Show a take-photo button on the Photo, then Take a photo with Camera in your button's event, with what comes next in that same event), or set ForChore back to "" when unticking, so a photo with nothing ticked goes nowhere.
Try it yourselfYour edits are saved in this browser.
Unticking a chore hides its photo.
Run your program. This ticks when your code does all of the above.
Lesson done. You've finished every step you need.
Now you can
Add a Photo and use the picture it takes or the one the user chooses.
Use a variable to remember something between two events.
Check that variable in sub-events, so one event does the right thing for each case.
Students give the chores checklist a photo per chore. A Photo object (camera allowed, or Choose a photo), a variable ForChore set when a chore's tick box is switched on, and one event, A photo is taken with Camera, whose sub-events check ForChore and show the photo beside the right chore. Nib's photo event skips the check, so every photo lands beside the bed. About 45 minutes.
I can add a Photo and use the picture it takes or the one the user chooses.
I can use a variable to remember something between two events.
I can check that variable in sub-events, so one event does the right thing for each case.
Before class
This lesson starts from the finished chores checklist (tick boxes and the dark mode button), with room made beside each chore for a hidden picture (BedPic, FeedPic, HomeworkPic). It's Level 3 (Photo); each step opens App Builder at Level 3. It follows Draw how you showed it, which met a picture the user makes, and the values journal, where a variable carried a choice between screens.
Camera: off unless Allow camera is ticked in the Photo's properties, and the browser asks too. Some school devices block cameras; Choose a photo (the button on every Photo) works everywhere, with no permission, and runs the same event. Photos stay in this browser (nothing is uploaded) and are shrunk to at most 1280 px.
Photos of things, not people: say so before the Try step. Students shouldn't photograph each other.
The second check question shows a gap on purpose: unticking doesn't clear ForChore, so a photo still goes to the last chore ticked. Make it yours hides the photo on untick; resetting ForChore to "" is in the ideas.
Running the lesson
Before Try: photos of objects only. Choose a photo works if cameras are blocked.
Build 2: ask what the photo event will know when it runs. Write ForChore on the board.
Build 3: checkpoint: two chores, two photos, each beside its own chore.
The hard part (on purpose)
The tick and the photo are two different moments, and students expect the photo event to just know which chore it's for. Ask: when the photo arrives, what does the app know? Only what something wrote down earlier: ForChore.
When students get stuck
The camera says it's off for this app. Ask: Is Allow camera ticked in the Photo's properties? Is the camera blocked on this computer? Fix: Tick it, or use Choose a photo, which works either way.
Nothing appears after a photo. Ask: Did you tick a chore first? What does ForChore say on the left? Fix: Tick a chore first (ForChore is set when ticking), and check each sub-event has Show as well as Set picture.
Every photo goes beside the bed. Ask: Does each Set picture action sit inside a sub-event that checks ForChore? Fix: Put each one in its own sub-event: ForChore = "Bed", "Feed" or "Homework".
Stretch and support
Stretch: Keep the photos in a table instead (chore, photo), so the app could show a history: that's how Data apps' A journal with drawings works.
Support: Do Build 3's first sub-event together; pairs copy it for Feed and Homework.
Where it leads
Next: Creature stats. A variable that remembers which one (ForChore here, ClickedItem later) comes back whenever an app handles several things with one event.
What each step is for
Try the finished app: Ticking a chore and then adding a photo, in that order, shows the two moments the app has to join together before building it.
Build 1: a Photo object: A Photo is an object like any other, but the camera stays off unless the app allows it and the user agrees, because a camera is private.
Build 2: remember which chore: The tick and the photo are two separate events, so a variable carries the chore from the first to the second, as Chosen carried the value between screens in the journal.
Build 3: put the photo beside its chore: One photo event serves all three chores; its sub-events check ForChore, so only the matching chore's picture changes.
Check: which chore gets it?: Tracing ForChore through a tick, an untick and a photo shows that a variable keeps its value until something sets it again.
Make it yours: untick hides the photo: Hiding the photo in the untick branch keeps what the app shows true to what's done.