← VCE Software Development U3O1

Hungarian notation for interface controls

Hungarian notation for a control: a type prefix (btn button, txt textbox, lbl label, lst list, cbo combobox) plus a purpose, so btnSubmit is clearly a button.

Understanding Hungarian notation for interface controls in VCE Software Development U3O1

What it does: btn is the prefix for a button and Save describes what it does, which follows Hungarian notation for controls. cbo is the prefix for a combobox and YearLevel describes the choice it offers, so the control type and purpose are both clear. txt is the prefix for a textbox. lbl is for a label, which only displays text. lbl stands for label, so lblResult is a label that is likely to display a result. lst is the prefix for a listbox. cbo is for a combobox (a drop-down). cbo marks a combobox. txt would wrongly suggest the user types into a textbox.

Common mistakes: A Button control should use the btn prefix, not txt. txtSubmit makes it look like a textbox. It should be btnSubmit. A Listbox should use the lst prefix. btnNames suggests a button. It should be lstNames.

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 48–71) and word search (Modules 10–71).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which name follows Hungarian notation for a button that submits a form?
btnSubmitsubmit
Matches
button1 = Button(window, text="Submit")
↓
The name has no type prefix and does not describe its purpose. It should be something like btnSubmit.
Applying
Meanings
Term
btnSubmit
Meaning
Hungarian notation for a control: a type prefix (btn button, txt textbox, lbl label, lst list, cbo combobox) plus a purpose, so btnSubmit is clearly a button.
Practice
lblName = tk.Label(root, text="Name:")
Testing
Gaps
Submit = Button(window, text="Submit")
Check Answer
Spots
2lblResult = Label(root)
3txtSubmit = Button(root)

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

The 'Golden Phoenix' badge — Savannah Legend, 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 name follows Hungarian notation for a button that submits a form?
A. btnSubmit ✓
B. submit
The prefix btn shows the control is a button, and Submit shows what it does.
2. Which prefix is normally used for a textbox control that accepts a student's name?
A. lblName
B. txtName ✓
txt is the prefix for a textbox. lbl is for a label, which only displays text.
3. True or false: the prefix in lblResult tells you the control is a label.
A. True ✓
B. False
lbl stands for label, so lblResult is a label that is likely to display a result.
4. Which control name describes what the control does, as well as its type?
A. btnCalculateTotal ✓
B. btn1
btn1 shows the type but not the purpose. btnCalculateTotal shows both.
5. Which name is a good choice for a listbox that shows a list of products?
A. cboProducts
B. lstProducts ✓
lst is the prefix for a listbox. cbo is for a combobox (a drop-down).

Match the Pairs

txtFirstName → A textbox control that collects the user's first name
lblResult → A label control used to display a result to the user
A button control that saves the entered data, named with the correct type prefix and purpose → btnSave
A combobox control for choosing a year level, named with the combobox prefix → cboYearLevel
button1 = Button(window, text="Submit") → The name has no type prefix and does not describe its purpose. It should be something like btnSubmit.
lstNames = Entry(window) → The prefix lst means a list, but an Entry is a textbox. The name should use txt, such as txtName.

Key Term

btnSubmit
Hungarian notation for a control: a type prefix (btn button, txt textbox, lbl label, lst list, cbo combobox) plus a purpose, so btnSubmit is clearly a button.

Fill in the Blanks

1. btnSubmit = Button(window, text="Submit")
Hint: Type the Hungarian prefix used for a button control.
2. txtName = Entry(window) name = txtName.get()
Hint: Type the prefix for a textbox control. The second line uses the same name.
3. lblResult = Label(window, text="") lblResult.pack()
Hint: Type the prefix used for a label control.
4. lstStudents = Listbox(window) lstStudents.pack()
Hint: Type the prefix used for a list control.
5. cboHouse = Combobox(window) print(cboHouse.get())
Hint: Type the prefix used for a combobox (drop-down) control.

Spot the Error

Question 1
A txtName = Entry(root)
B lblResult = Label(root)
C txtSubmit = Button(root)
Line C — A Button control should use the btn prefix, not txt. txtSubmit makes it look like a textbox. It should be btnSubmit.
Question 2
A btnNames = Listbox(root)
B btnAdd = Button(root)
C lblTotal = Label(root)
Line A — A Listbox should use the lst prefix. btnNames suggests a button. It should be lstNames.
Question 3
A cboHouse = Combobox(root)
B lblPoints = Entry(root)
C btnSave = Button(root)
Line B — An Entry is a textbox, so it needs the txt prefix, not lbl. A label only displays text. It should be txtPoints.
Question 4
A txtAge = Entry(root)
B lblAge = Label(root)
C btnCheck = Button(root)
D result = Label(root)
Line D — The name has no type prefix, so you cannot tell it is a label. The control should be named lblResult.
Question 5
A cboYear = Combobox(root)
B btnEnter = Button(root)
C lbl1 = Label(root)
Line C — The prefix is right, but the name 1 does not say what the control does. A control should be named for its purpose, such as lblError.

Student with a class code? Join your class →