[Python-ideas] A GUI for beginners and experts alike

Chris Angelico rosuav at gmail.com
Fri Aug 24 15:25:37 EDT 2018


On Sat, Aug 25, 2018 at 5:13 AM, Mike Barnett <mike_barnett at hotmail.com> wrote:
> Here we go:
>
> Take 3 numbers as input (A, B, C).  Add them together.  Display the result in a simple pop-up window.
>
> That’s a pretty typical kind of problem for the first few weeks of beginning programming.  Maybe first few days.
>

Do you mean "beginning GUI programming", or are you saying that this
kind of thing should be in someone's first few days of programming
overall? I disagree with the latter; for the first days of a
programmer's basic training, the REPL is ample. No GUI needed, don't
even need input() at that stage. While I would generally teach input()
before any GUI toolkit, the opposite decision is also valid, but
definitely neither is needed right off the bat.

For someone's earliest forays into GUI programming, I would actually
*still* not word the challenge that way. I would keep everything in a
SINGLE window, because that showcases a major strength of a GUI - that
you can interact with it multiple times, rather than being forced into
a linear workflow. So here's my alternative challenge:

Take two numbers as inputs. Add them together and display them in a
third field. Whenever either input is changed, recalculate the output.

This requires proper event handling, so it's less likely to create a
useless one-liner that has no bearing on real-world code.

ChrisA


More information about the Python-ideas mailing list