GUI program structure and MVC

18-minute lesson · module-gui-04

You are previewing this course as a guest

Read anything and run any exercise you like. It all runs in your own browser, so nothing here is saved: no XP, no progress, and the AI tutor needs an account. Sign in and your work starts counting.

Sign in

GUI program structure and MVC

18-minute lesson · module-gui-04

  • Explain why a growing GUI app benefits from a deliberate structure.
  • Describe the Model, View, and Controller roles and what belongs in each.
  • Identify which parts of a tkinter app are model, view, and controller.
  • Refactor a small GUI so its data logic is separate from its widgets.

Source attribution

Status: adapted

How to Think Like a Computer Scientist: Interactive Edition source · GUI and Event Driven Programming / GUI Program Structure / Modifying Widgets / Model-View-Controller

Adaptation notes. Read-along lesson. tkinter needs a native window and event loop the Pyodide sandbox lacks, so there is no graded coding step. Code is for reading and local running. The temperature-converter example is ours; prose is original.

License notes. Original chapter is GNU FDL 1.3 (Brad Miller, David Ranum, and the upstream Elkner/Downey/Meyers text). No verbatim text reproduced.