Now, the execution of the code,
when you're talking about one of these graphic user interface programs it's
typically not completely controlled by the programmer but by the user, instead.
So what that means is the programmer writes code and
the code lists a bunch of lines of code that execute in a certain sequence.
Right, and with a regular Python program, everything, the order is completely
controlled by the programmer and the data the programmer receives.
But the programmer writes the sequence of instructions and
determines in what sequence they will execute, right?
And there are options, if-then statements, might execute this sequence or that.
But the programmer is in control of that by the way they write the code.
Now with a graphic user interface what happens is that the code that gets
executed is determined by what the user does in the interface.
That is if the user clicks on one button and then function gets called and
if user clicks on another button then another function get called.
So which function gets called isn't completely under
the control of the programmer.
In a regular Python program, you can have an if statement,
if this is true call function one else call function two.
Then the program determines one of these two things is gonna happen, but
with a graphic user interface these functions their
execution is controlled by the user and what they do.
Maybe they move a slider and then this function gets executed and so on.
That actually makes coding somewhat harder for
the programmer because you can't predict the control flow sequence as well, right?
You don't know exactly,
maybe the program's gonna press this button 100 times, right?
You don't know what random sequence they're gonna press, and
you have to accommodate all possible sequences.
So in general, it makes programming more difficult,
but you get a graphic user interface, and that's a good thing.
Okay, so often,
graphic user interface based programs are written as one big event loop, okay?
And this is simpler than it sounds, typically the program waits.
[LAUGH] It just sits there waiting for the user to interact with a widget, okay?
So it doesn't do anything it just sits there statically,
maybe it does some initial stuff.
But it puts a screen out there and it sits there and waits.
Until the user does something, type something and when the user isn't typing
anything, click anything, the code's not doing anything often.
So the user pushes a button or selects a menu item or
something, draws something, grabs a slider, does some event, okay.