Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1root = tk.Tk() | ACreates the main tkinter window and stores it in the variable root | |
| 2root.mainloop() | Broot.title("My App") | |
| 3Set the text shown in the title bar of the window | Croot.geometry("400x300") | |
| 4Set the window size to 400 pixels wide and 300 pixels high | Dtk.Tk is missing its brackets, so no window is created. It should be tk.Tk(). | |
| 5import tkinter as tk root = tk.Tk() root.mainloop() root.title("Quiz") | EShows the window and waits for events such as clicks and key presses | |
| 6import tkinter as tk root = tk.Tk root.mainloop() | Froot.mainloop() is placed before root.title(), so the title line only runs after the window is closed. mainloop() must be the last line. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
root = tk.Tk() — 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.import tkinter as tk
root = tk.Tk()
root.mainloop()import tkinter as tk
root = tk.Tk()
root.mainloop()import tkinter as tk
root = tk.Tk()
root.mainloop()root = tk.Tk()
root.title("My App")
root.mainloop()root = tk.Tk()
root.geometry("400x300")
root.mainloop()