Next: , Previous: Attributes, Up: Curses Tutorial   [Contents][Index]

4.9 Windows Tutorial

Windows form the most important concept in curses. You have seen the standard window stdscr used in most of the previous examples. Now to design even a simplest GUI, you need to resort to windows. The main reason you may want to use windows is to manipulate parts of the screen separately, for better efficiency, by updating only the windows that need to be changed, and for a better design. I would say the last reason is the most important in going for windows. You should always strive for a better and easy-to-manage design in your programs. If you are writing big, complex GUIs, this is of pivotal importance before you start doing anything.

Now, anyone that has worked with a modern GUI has an intuitive understanding of what a “window” is. You will need to unlearn this knowledge when programming curses windows.

First off, a curses window doesn’t necessarily have any sort of border or decoration that separates it from the rest of the terminal. You can make a curses window and then draw a border on it, but, that is up to the programmer.

Second, curses windows don’t normally overlap. They are usually distinct, non-overlapping regions of the screen.