← VCE Software Development U3O1

GUI Label control

Creates a tkinter label that shows text in the window. Use .config(text=...) to change what it shows, such as displaying a result. Options like font and fg set style.

Understanding GUI Label control in VCE Software Development U3O1

What it does: The font option sets the typeface and size, and fg sets the foreground (text) colour. The number is converted with str() and passed to .config(text=...) so the label displays the output. A label must also be placed in the window with .pack() or .grid() before it appears. Variables in an f-string must be wrapped in curly braces, like {total}. Without braces, the word total is shown literally.

Common mistakes: The option that changes a label's words is text, not txt. It should be lbl.config(text="Bye"). The class name is case-sensitive. It must be tk.Label with a capital L, not tk.label.

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 125–141) and word search (Modules 114–141).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line creates a label that shows the text Score: 0 in the window root?
tk.Label(root, 'Score: 0').texttk.Label(root, text='Score: 0')
Matches
lblResult = tk.Label(root, 'Hello')
↓
The text is not given using the text= option, so the label does not know it is the text to show. Use text='Hello'.
Applying
Meanings
Term
tk.Label(root, text='...')
Meaning
Creates a tkinter label that shows text in the window. Use .config(text=...) to change what it shows, such as displaying a result. Options like font and fg set style.
Practice
import tkinter as tk
Testing
Gaps
lbl = tk.(root, text='Score: 0')
Check Answer
Spots
3lbl.pack()
4lbl.config(txt="Bye")

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

The 'Nautilus' badge — Default Expert, 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. Which line creates a label that shows the text Score: 0 in the window root?
A. tk.Label(root, 'Score: 0').text
B. tk.Label(root, text='Score: 0') ✓
The text option sets what a Label shows: tk.Label(root, text='...'). The label is created inside the window root.
2. A label is stored in a variable called result_label. Which line changes the text it shows to Pass?
A. result_label.get('Pass')
B. result_label.config(text='Pass') ✓
Use .config(text=...) to change a label after it is created. .get() reads from an Entry control and does not set label text.
3. True or false: A Label control is mainly used to show text or output to the user, not to type into.
A. True ✓
B. False
A Label displays text such as instructions or results. An Entry control is the one the user types into.
4. Which line makes a label show its text in red?
A. tk.Label(root, text='Error', fg='red') ✓
B. tk.Label(root, text='Error', colour='red')
The fg option sets the text (foreground) colour. tkinter has no colour option, so colour='red' causes an error.
5. Which line sets a label's font to Arial size 16?
A. tk.Label(root, text='Hi', font=('Arial', 16)) ✓
B. tk.Label(root, text='Hi', font='Arial' 16)
The font option takes a tuple of the font name and size: font=('Arial', 16). Without the brackets and comma, it is a syntax error.

Match the Pairs

tk.Label(root, text='Score: 0') → Creates a label in the window that displays the text Score: 0
lblResult.config(text='Total: 25') → Changes the existing label so it now shows Total: 25
Style a label with a font and a text colour → tk.Label(root, text='Hi', font=('Arial', 16), fg='blue')
Show a calculated result in a label after a calculation → lblOutput.config(text=str(total))
lblResult = tk.Label(root, 'Hello') → The text is not given using the text= option, so the label does not know it is the text to show. Use text='Hello'.
lblResult.config(text=total) lblResult.text = 'Done' → Setting .text directly does not change the label. Use lblResult.config(text='Done') to update what it shows.

Key Term

tk.Label(root, text='...')
Creates a tkinter label that shows text in the window. Use .config(text=...) to change what it shows, such as displaying a result. Options like font and fg set style.

Fill in the Blanks

1. lbl = tk.Label(root, text='Score: 0')
Hint: Type the tkinter control class that shows text in a window.
2. lbl = tk.Label(root, text='Welcome')
Hint: Type the option name that sets the words the label displays.
3. result = 7 * 6 lbl.config(text=result)
Hint: Type the method name that changes an existing label's options to show a new result.
4. lbl = tk.Label(root, text='Hi', fg='red')
Hint: Type the short option name that sets the colour of the label's text.
5. lbl = tk.Label(root, text='Hi', font=('Arial', 16))
Hint: Type the option name that sets the typeface and size of the label text.

Spot the Error

Question 1
A root = tk.Tk()
B lbl = tk.Label(root, text="Hi")
C lbl.pack()
D lbl.config(txt="Bye")
E root.mainloop()
Line D — The option that changes a label's words is text, not txt. It should be lbl.config(text="Bye").
Question 2
A root = tk.Tk()
B title = tk.label(root, text="Score")
C title.pack()
D root.mainloop()
Line B — The class name is case-sensitive. It must be tk.Label with a capital L, not tk.label.
Question 3
A root = tk.Tk()
B result = tk.Label(root, text="")
C result.pack()
D result.config(text="Total: 5"
E root.mainloop()
Line D — The line is missing its closing bracket. It should be result.config(text="Total: 5").
Question 4
A import Tkinter as tk
B root = tk.Tk()
C lbl = tk.Label(root, text="Hello")
D lbl.pack()
Line A — In Python 3 the module name is all lowercase. It should be import tkinter as tk.
Question 5
A root = tk.Tk()
B lbl = tk.Label(root, text=Hi)
C lbl.config(fg="red")
D lbl.pack()
Line B — The label text is a string, so it needs quotes. Without them Python looks for a variable called Hi. It should be text="Hi".

Student with a class code? Join your class →