← QCE Digital Solutions Unit 3

Components of a mobile application

The parts that make up a mobile app: interface controls on screens, objects with data and behaviour, event handlers that respond to the user, and libraries of ready-made code.

Understanding Components of a mobile application in QCE Digital Solutions Unit 3

What it does: The Player object stores data such as a name and score, and has behaviour such as add_points(). Labels and buttons are interface controls placed on a screen to show information and take input. An event handler is code that runs when an event, such as a tap, happens. A label only displays text. Event handlers wait for events and then run. They can run many times while the app is in use. Libraries save time because the code is already written and tested. Storage for photos is a different thing. Using a trusted library saves development time and reduces errors. Writing it from scratch is slower and riskier.

Common mistakes: The parent window w is a positional argument and must come before the keyword argument text=. The correct line is lbl = tk.Label(w, text="Hi"), which puts the Label control on the screen. Writing go() runs the handler straight away and passes its result to the button. The button needs the handler itself, so use command=go with no brackets. Then go runs when the user taps.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 15–119) and word search (Modules 15–176).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A button, a text box and a label on a screen are examples of which mobile app component?
External librariesInterface controls on a screen
Matches
button.onClick(save_score())
↓
The handler is called straight away because of the brackets, so it runs when the screen loads, not when the user taps. Pass the function name without brackets.
Applying
Meanings
Term
app components
Meaning
The parts that make up a mobile app: interface controls on screens, objects with data and behaviour, event handlers that respond to the user, and libraries of ready-made code.
Practice
IMPORT maps_library
Testing
Gaps
btn = (root, text="Go", command=start)
Check Answer
Spots
1w = tk.Tk()
2lbl = tk.Label(text="Hi", w)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Scorpion' badge — Venom Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A button, a text box and a label on a screen are examples of which mobile app component?
A. Interface controls on a screen ✓
B. External libraries
Buttons, text boxes and labels are controls. They make up the screen the user sees and touches.
2. Which describes an object in a mobile app?
A. It is a screen that only displays pictures
B. It holds data and behaviour together, like a Player with a score and a jump action ✓
An object bundles data (properties) with behaviour (methods). A screen is a different kind of component.
3. A user taps the Save button and the app stores their note. Which component responds to the tap?
A. An event handler ✓
B. A label control
An event handler is code that runs when an event, such as a tap, happens. A label only displays text.
4. Which statement about event handlers is correct?
A. They run only once, when the app is first installed
B. They run in response to a user action such as a tap or swipe ✓
Event handlers wait for events and then run. They can run many times while the app is in use.
5. Your team adds a ready-made maps library so the app can show a map. What is a library?
A. Ready-made code written by others that your app can reuse ✓
B. A folder where the app stores user photos
Libraries save time because the code is already written and tested. Storage for photos is a different thing.

Match the Pairs

button.onClick(save_score) → An event handler: when the user taps the button, the save_score function runs
import maps_library → Brings in a library of ready-made code, such as map features, so the app does not need to build them
An object holds data (attributes) and behaviour (methods) together → player = Player('Ava', 120) player.add_points(10)
A screen is made from interface controls such as labels and buttons that the user sees and taps → screen.add(Label('Score'), Button('Play'))
button.onClick(save_score()) → The handler is called straight away because of the brackets, so it runs when the screen loads, not when the user taps. Pass the function name without brackets.
player.score = 'ten' + 5 → The object's data is mixed up: a text value is added to a number, which causes an error. Score should hold a number, such as player.score = 10 + 5.

Key Term

app components
The parts that make up a mobile app: interface controls on screens, objects with data and behaviour, event handlers that respond to the user, and libraries of ready-made code.

Fill in the Blanks

1. btn = Button(root, text="Go", command=start)
Hint: Type the name of the interface control (widget) that the user taps or clicks.
2. class Player: def __init__(self, name): self.name = name
Hint: Type the special method name that sets up an object's data when it is created.
3. btn = Button(root, command=on_tap)
Hint: Type the argument name that links the control to the event handler function.
4. import requests data = requests.get(url)
Hint: Type the keyword that loads a library of ready-made code into the app.
5. root = Tk() label = Label(root, text="Score") root.mainloop()
Hint: Type the method that keeps the screen open and waits for user events.

Spot the Error

Question 1
A w = tk.Tk()
B lbl = tk.Label(text="Hi", w)
C lbl.pack()
D w.mainloop()
Line B — The parent window w is a positional argument and must come before the keyword argument text=. The correct line is lbl = tk.Label(w, text="Hi"), which puts the Label control on the screen.
Question 2
A def go():
B print("Tapped")
C b = tk.Button(w, command=go())
D b.pack()
Line C — Writing go() runs the handler straight away and passes its result to the button. The button needs the handler itself, so use command=go with no brackets. Then go runs when the user taps.
Question 3
A class Task:
B def __init__(self, name):
C name = name
D t = Task("Homework")
Line C — This only changes a local variable, so the object never stores its data. It should be self.name = name, so the Task object keeps the name.
Question 4
A import Random
B dice = random.randint(1, 6)
C print(dice)
Line A — Python module names are case-sensitive. The library is called random in lowercase, so it must be imported as import random before its code can be used.
Question 5
A import tkinter as tk
B w = tk.Window()
C box = tk.Entry(w)
D box.pack()
Line B — tkinter has no Window class. The main app window is created with tk.Tk(), so the line should be w = tk.Tk().

Student with a class code? Join your class →