Creating a tkinter window
Creates the main tkinter window after import tkinter as tk. Call root.mainloop() at the end to show the window and wait for events like clicks.
Understanding Creating a tkinter window in VCE Software Development U3O1
What it does: root.title() takes a string and displays it in the title bar of the window created with tk.Tk(). tk.Tk() creates the main window object. There is no tk.window() function in tkinter. The module is called tkinter. 'as tk' gives it the short name tk, so tk.Tk() works. mainloop() starts waiting for events and runs until the window is closed. root must exist first, and any setup code placed after mainloop() would not run until the window closes. The title() method sets the title bar text. tkinter has no name() method for this. geometry() takes ONE string in the form 'widthxheight', such as '400x300'. It does not take two separate numbers.
Common mistakes: The window class is Tk with a capital T. tk.tk() causes an AttributeError. It should be root = tk.Tk(). Python is case-sensitive and the method name is all lowercase. root.Title does not exist. It should be root.title("Quiz").
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 114–124) 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.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
root = tk.Tk()Fill in the Blanks
Spot the Error
Student with a class code? Join your class →