GUI intro and dialog boxes

16-minute lesson · module-gui-01

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 intro and dialog boxes

16-minute lesson · module-gui-01

  • Explain what a GUI is and how tkinter relates to Python.
  • Create a root window and start the tkinter event loop.
  • Add a Label to a window and display text.
  • Pop up a standard message or input dialog with the messagebox and simpledialog modules.

Source attribution

Status: adapted

How to Think Like a Computer Scientist: Interactive Edition source · GUI and Event Driven Programming / Intro GUI / Standard Dialog Boxes

Adaptation notes. Read-along lesson. tkinter needs a native windowing system and a running event loop, neither of which exists in the Pyodide browser sandbox, so there is no graded coding step. All code is for reading and for running on the student's own computer. Examples are 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.