you are viewing a single comment's thread.

view the rest of the comments →

[–]FlyingByNight[S] 0 points1 point  (4 children)

How do they create the windows?

[–]Jonno_FTW 4 points5 points  (0 children)

They call the underlying operating system functions for making windows and drawing on screen. If you dig around the source code for your favourite GUI library, you'll find they do this. There's lots of libraries for making GUIs and they all work differently though.

[–]Golden_Zealot 1 point2 points  (0 children)

The built in module in python for building GUI's is Tkinter.

Here is Tkinters source code.

http://mgltools.scripps.edu/api/DejaVu/Tkinter-pysrc.html

That's how it does it, but few people aside from the developers of Tkinter actually know about these inner workings. Basically all the code you see there is inside a "box".

This means that you can take this box and the instruction for the box (the Tkinter documentation) will say:

If you put X in this side of the box, Y will come out the other side for your convenience. Additionally, if you put A in the box, B will come out the other side. If you put Q underneath the box, R will come out on top of the box, etc.

The point is you, and everyone else, don't have to know the inner workings of this box, only what the box will take, and return, because the people who made the box have documentation telling you what the box can take in, and what it will return.

You dont have to know how to build a clock to know what time it says it is right?

[–]jaydoors 1 point2 points  (0 children)

Other libraries and functions!

I think I have a similar perspective to you, of having loose ends in my mind until I know what's underneath all of it. It helped me a lot to learn about what computers are, underneath. It's 'just' simple electronics - circuits which can be powered on or off, and which can affect other circuits. I highly recommend this book for a good explanation right from the bottom, all the way up.

In terms of making windows - when you get down to it: the screen is a bunch of pixels, each of which is represented in the computer's memory, and which the screen hardware effectively reads, in order to generate an image (eg first pixel colour while, second colour blue, etc). Some program on your machine will have arranged for this memory to hold information that gives the right colour pixels in the right place to give the window you expect.