Chapter 10. Frameworks and Applications

All the examples in this book so far have been quite small, and they may seem toys compared to real-world applications. This chapter shows some of the frameworks that are available to Python programmers who wish to build such applications in some specific domains. A framework can be thought of as a domain-specific set of classes and expected patterns of interactions between these classes. We mention just three here: the COM framework for interacting with Microsoft’s Common Object Model, the Tkinter graphical user interface (GUI), and the Swing Java GUI toolkit. Along the way we also use a few of the web-related modules in the standard library.

We illustrate the power of frameworks using a hypothetical, real-world scenario, that of a small company’s web site, and the need to collect, maintain, and respond to customer input about the product through a web form. We describe three programs in this scenario. The first program is a web-based data entry form that asks the user to enter some information in their web browser, and then saves that information on disk. The second program uses the same data and automatically uses Microsoft Word to print out a customized form letter based on that information. The final example is a simple browser for the saved data built with the Tkinter module, which uses the Tk GUI, a powerful, portable toolkit for managing windows, buttons, menus, etc. Hopefully, these examples will make you realize how these kinds of ...

Get Learning Python 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.