I l@ve RuBoard |
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 toolkits, when combined with the rapid development power of Python, can truly let you build "real" applications fast. Each program builds on the previous one, so we strongly recommend that you read through each program, even if you can't (or don't wish to) get them up and running on your computer.
The last section of this chapter covers JPython, the Java port of Python. The chapter closes with a medium-sized JPython program that allows users to manipulate mathematical functions graphically using the Swing toolkit.
I l@ve RuBoard |