A. The after() call incorrectly calls update() immediately instead of scheduling it
B. Label text cannot be updated using config()
C. root.mainloop() is missing
D. Label is not packed into the window
Solution
Step 1: Identify after() usage error
The code uses root.after(1000, update()) which calls update() immediately instead of passing the function reference.
Step 2: Correct usage
It should be root.after(1000, update) without parentheses to schedule the call.
Final Answer:
The after() call incorrectly calls update() immediately instead of scheduling it -> Option A
Quick Check:
Pass function to after(), don't call it [OK]
Hint: Use function name without () in after() to schedule [OK]
Common Mistakes:
Calling function inside after() instead of passing reference
Thinking config() can't update label text
Forgetting to pack the label
Missing mainloop() call
5. You want to build a Tkinter dashboard on Raspberry Pi that shows live temperature and humidity from sensors. Which approach best ensures the GUI stays responsive while updating sensor data every second?
hard
A. Use time.sleep(1) inside the update function to delay updates
B. Use an infinite while loop inside the main thread to read sensors and update labels
C. Call sensor read functions once before mainloop and never update labels
D. Use after method to schedule sensor reads and label updates without blocking mainloop
Solution
Step 1: Understand GUI responsiveness
Tkinter's mainloop must not be blocked; blocking causes the window to freeze.
Step 2: Evaluate update methods
Using after schedules updates without blocking, keeping GUI responsive. Infinite loops or sleep block the main thread.
Final Answer:
Use after method to schedule sensor reads and label updates without blocking mainloop -> Option D
Quick Check:
after() schedules non-blocking updates [OK]
Hint: Never block mainloop; use after() for periodic updates [OK]
Common Mistakes:
Using while loops or sleep blocking the GUI
Not updating sensor data after startup
Ignoring GUI freezing issues
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.