📄 index.lxp@lxpwrap=c88_252ehtm.htm
字号:
<table border="0" cellspacing="0" cellpadding="3" width="100%"><tr><td> <div align="center" id="bldcontent"> <a href="../default.htm"><img src="../images/opendocs.png" width="63" height="76" border="0"></a> <br> <div class="symbol">Your OpenSource Publisher™</div> </div> </td></tr></table> <div align="center" class="author"> <a href="../products.lxp">Products</a> | <a href="../wheretobuy.lxp">Where to buy</a> | <a href="../bookstore.lxp">Retailers</a> | <a href="../faq.lxp">FAQ</a> | <a href="../writeforus.lxp">Write for Us.</a> | <a href="#contact">Contact Us.</a> </div> <table border="0" cellspacing="3" cellpadding="0" width="100%"><tr><td width="100%"> <div class="content"> <table border="0" cellspacing="2" cellpadding="0" width="100%"><tr><td width="100%"> <div align="center"><H4 CLASS="AUTHOR"><A NAME="AEN5">Boudewijn Rempt</A><br><a href="../../https@secure.linuxports.com/opendocs/default.htm"><img src=odpyqt125.png></a><br>ISBN: 0-97003300-4-4<br><a href="../../https@secure.linuxports.com/opendocs/default.htm">Available from bookstores everywhere or you can order it here.</a><p>You can download the source files for the book <a href="pyqtsrc.tgz">(code / eps) here.</a><hr></div> <HTML><HEAD><TITLE>Introduction</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.72"><LINKREL="HOME"TITLE="GUI Programming with Python: QT Edition"HREF="book1.htm"><LINKREL="PREVIOUS"TITLE="Acknowledgments"HREF="x76.htm"><LINKREL="NEXT"TITLE="GUI programming with Python"HREF="x179.htm"></HEAD><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">GUI Programming with Python: QT Edition</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><A accesskey="P" href="index.lxp@lxpwrap=x76_252ehtm.htm">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><A accesskey="N" href="index.lxp@lxpwrap=x179_252ehtm.htm">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1>Chapter 1. Introduction</A></H1><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><A href="index.lxp@lxpwrap=c88_252ehtm.htm#AEN112">Python</A></DT><DT><A href="index.lxp@lxpwrap=x179_252ehtm.htm">GUI programming with Python</A></DT><DT><A href="index.lxp@lxpwrap=x258_252ehtm.htm">About the BlackAdder IDE</A></DT></DL></DIV><P>Developing decent software is difficult — monstrously difficult, in fact. People are always looking for miracle cures, silver bullets that will help them creating great software in no time with no conscious effort. In fact, almost everyone will agree to the existence of a ‘software crisis'. Projects <SPAN><ICLASS="EMPHASIS">do</I></SPAN> deliver too little functionality, too late and often of a too low quality. Frederick Brooks was the first to note this, in his famous book <ICLASS="CITETITLE">The燤ythical燤an-Month</I>. More's the pity that there aren't any miraculous solutions for the many problems that plague software development. </P><P>There is simply no single innovation that will make you ten times more productive, no single innovation that will ensure that whatever you do, you will produce bug-free software and no single innovation that will make your applications run will all the vim and vigor your users desire and deserve.</P><P>However, it is quite possible, by simply using the best possible tools and practices, to be far more productive than would be possible by following the usual practices and by using inferior tools. </P><P>It's amazing how many software development environments have been designed with something else than developer productivity as the main goal. There's Visual Basic, which, while infinitely more productive than previous attempts at creating a rapid development environment for Windows, still is mainly concerned with preventing people from creating applications that can compete with Microsofts' own applications. Java, while quite usable, tries far too hard to protect me from myself and my colleagues — like early versions of Pascal. C++ is enormously large and complicated, because of its compatibility goals with C — almost too big to learn to handle. In contrast, Python was designed to be small, practical and to be as open as possible to the developer.</P><P>In Python, all other considerations, are secondary to considerations of development speed, code maintainability and code reusability.</P><P>Python offers everything you need to put the best practices into practice, like object oriented design, unit testing and maintaining documentation in the code, but it doesn't keep you from messing with the more messy parts of the operating system — you can always use an extension module written in C or C++ — or with the internals of Python itself. It is ideal for rapid prototyping, but also for the development of large applications by large teams of programmers.</P><P>Python code is meant to be readable. Indenting correctly and neatly is not merely a good habit: it is essential to delimit blocks of code. Likewise, there is little use for comic-book swearing characters like ‘!@#$#%$' that other languages use to indicate the type of a variable, or even for variable declarations and all those other things that keep you from writing the logic of your application. The most famous description of Python is that it's ‘executable pseudo-code'!</P><P>However, what Python has been lacking until recently was a good development environment. Of course, since all Python code is simple text, and since you don't need pre-processors or compilers, you can get by with nothing more than a text editor, like <SPANCLASS="APPLICATION">XEmacs</SPAN> <SPANCLASS="APPLICATION">Nedit</SPAN>, or <SPANCLASS="APPLICATION">MultiEdit</SPAN>. Indeed, I've used <SPANCLASS="APPLICATION">Nedit</SPAN> exclusively for years — but some project management facilities, a tighter integration with a GUI builder and a good debugger can make life infinitely more pleasant, and thus productive.</P><P><SPANCLASS="APPLICATION">BlackAdder</SPAN> is such an environment. Others are <SPANCLASS="APPLICATION">Wing IDE</SPAN>, <SPANCLASS="APPLICATION">PythonWorks</SPAN>, <SPANCLASS="APPLICATION">PythonWin</SPAN>, <SPANCLASS="APPLICATION">Komodo</SPAN> and, perhaps, <SPANCLASS="APPLICATION">IDLE</SPAN>. Of these, only <SPANCLASS="APPLICATION">BlackAdder</SPAN> runs on both Windows and Linux, includes a full-featured GUI designer and provides a dependable debugger. Applications developed with Python and BlackAdder can run on any Unix platform with X11 and on any 32-bits Windows platform (and in the near future on Apple's OS X, too).</P><DIVCLASS="SECT1"><H1CLASS="SECT1">Python</A></H1><P>Python is a modern programming language, with strong object-oriented features, a small set of basic functions and large set of libraries. The most important features of Python are:</P><P></P><UL><LI><P>Compiled to byte-code, interpreted by a virtual machine.</P></LI><LI><P>High-level data structures: lists, tuples and dictionaries</P></LI><LI><P>Dynamic: you can even add new base-classes to an existing object, run-time.</P></LI><LI><P>Portable: the same Python bytecode will run — depending on which version of Python you use and which C or C++ extensions are used — on Unix, Windows, MacOS, Amiga, Palm OS and many others.</P></LI><LI><P>Extensible with modules written in C or C++: there is <SPAN><ICLASS="EMPHASIS">no</I></SPAN> performance penalty for calling native code, as there is when calling native code from Java.</P></LI><LI><P>An object-oriented programming model, but also supports functional programming (a bit) and old-fashioned structured programming.</P></LI><LI><P>Enormous set of extension libraries: for database access, high-performance number-crunching, for sound-file analysis, for GUI programming and countless other tasks.</P
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -