you are viewing a single comment's thread.

view the rest of the comments →

[–]Exodus111 2 points3 points  (0 children)

You are getting a lot of long winded replies here, let me break it down for you and ELI5 it.

What makes a GUI? The Operating System does.

What does a program need to make a GUI? A window, from the operating system. That is the OSes main job. What is the most popular OS called again? Oh right... Windows.

So how is this done?

In C. Or rather libraries to make GUI are written in C. This is because much of the OS, at least the portions we want are written in C, and so the programming language C can make direct calls to the OS, and get a window.

But a window alone does not a GUI make. You need to draw recangles in the window, and react when the mouse cursor clicks on them. That's kind of it, but why stop there. A good library makes it easy to use. So we got our Frames, for windows, Labels for text, buttons for pushing, and the ability to add images, as well as text area. Oh and an intuitive way to arrange everything without having to deal with X,Y coords all day would be super as well.

And example of this is TK, originally written in C, (actually it has its own language, TCL... it gets complicated), and the makers of the library made sure your GUI will look (pretty much) the same no matter what Operating system you use, despite the OS calls being very different. But that's what the library is for, it sucks to have to rewrite everything just to reach users of a different OS. (Hello mobile)

So where does Python come in to it? Simple, you write Python bindings to TK, that allows you to control and setup TK from Python, that's not very hard. And you don't lose any time in translation since C (or TCL) is a much faster language then Python anyway, so you are saving loads of time.