星期二, 八月 29, 2006

wxPython Digest

Introduction

wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is implemented as a Python extension module (native code) that wraps the popular wxWidgets cross platform GUI library, which is written in C++.

Like Python and wxWidgets, wxPython is Open Source.

wxPython is a cross-platform toolkit.
 

wxWidgets is a C++ framework providing GUI (Graphical User Interface) and other facilities on more than one platform.

wxWidgets was originally developed at the Artificial Intelligence Applications Institute, University of Edinburgh, for internal use, and was first made publicly available in 1992. Version 2 is a vastly improved version written and maintained by Julian Smart, Robert Roebling, Vadim Zeitlin, Vaclav Slavik and many others.

 

Here are some of the benefits with wxPython:

1. Low cost (free, in fact!)
2. You get the source.
3. Available on a variety of popular platforms.
3. Works with almost all popular C++ compilers and Python.
4. Over 50 example programs.
5. Over 1000 pages of printable and on-line documentation.
6. Includes Tex2RTF, to allow you to produce your own documentation in Windows Help, HTML and Word RTF formats.
7. Simple-to-use, object-oriented API.
8. Flexible event system.
9. Graphics calls include lines, rounded rectangles, splines, polylines, etc.
10. Constraint-based and sizer-based layouts.
11. Print/preview and document/view architectures.
12. Toolbar, notebook, tree control, advanced list control classes.
13. PostScript generation under Unix, normal MS Windows printing on the PC.
14. MDI (Multiple Document Interface) support.
15. Can be used to create DLLs under Windows, dynamic libraries on Unix.
16. Common dialogs for file browsing, printing, colour selection, etc.
17. Under MS Windows, support for creating metafiles and copying them to the clipboard.
18. An API for invoking help from applications.
19. Ready-to-use HTML window (supporting a subset of HTML).
20. Dialog Editor for building dialogs.
21. Network support via a family of socket and protocol classes.
22. Support for platform independent image processing.
23. Built-in support for many file formats (BMP, PNG, JPEG, GIF, XPM, PNM, PCX).


wxPython Overview

To set a wxPython application going, you will need to derive an App class and override App.OnInit.

Instances of Dialog can also be used for controls, and they have the advantage of not requiring a separate frame.

You never draw directly onto a window. Instead, you use a device context (DC). DC is the base for ClientDC, PaintDC, PostScriptDC, MemoryDC, MetafileDC and PrinterDC. If your drawing functions have DC as a parameter, you can pass any of these DCs to the function, and thus use the same code to draw to several different devices. You can draw using the member functions of DC, such as DC.DrawLine and DC.DrawText. Control colour on a window (Colour) with brushes (Brush) and pens (Pen).

 


没有评论: