1.14. Designing Your Windows (A Short Lecture)

Before you decide what events to handle, it is worthwhile to spend some time sketching out a few windows on paper and deciding what should happen (from the user's perspective) when you click a button or invoke a menu item.

One of the most important things to keep in mind when you design your application's windows is that nothing happens until that event loop starts up. Everything prior to the call to MainLoop is just preparation for the event loop.

A GUI often makes the application look much more polished and purposeful than a command-line interface does. Also, it is often much easier to manipulate many different kinds of user input through a GUI.

Here are some things to consider when you are deciding what the GUI should look like:

  • Every widget should have a purpose. It should be intuitive and informative.

  • Think about the way a user will use an application and design it accordingly.

  • Don't try to cram everything your application is doing into one window.

  • Don't always try to separate everything into different windows. Sometimes the application is so simple that one window is all you need.

  • Colors are great, but there are a lot of color-blind people out there. If you insist on using color, allow it to be customized via a file or through the application itself.

  • Some widgets do their job better than others do. Use the right widget for the right job.

That's it for the lecture. Now, get ready to learn the ropes.

Get Learning Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.