Qt 的 Python 版本 PyQt 4.8.6 发布
fmms 13年前
<div id="p_fullcontent" class="detail"> <p><span id="zoom" class="a14c">PyQt是Qt库的Python版本。PyQt3支持Qt1到Qt3。 PyQt4支持Qt4。它的首次发布也是在1998年,但是当时它叫 PyKDE,因为开始的时候SIP和PyQt没有分开。PyQt是用SIP写的。PyQt遵从奇趣的许可模式,有GPL版和商业版。</span></p> <p><span id="zoom" class="a14c">PyQt向Python程序员提供了使用完整Qt应用程序接口的方法。您几乎可以用Python做任何C++能做的事。</span></p> <p><span id="zoom" class="a14c">既 然是应用程序接口,用C++或是Python都是一样的。于是“为什么我得使用它”这个问题就可以归结为编程语言的选择上,而不一定要用PyQt。对我来 说作为一种编程语言,python相对于c++的优点是在编程效率上。您可以看到标准的Qt例子移植到PyQt后的代码。它们具有相同的功能,使用相同的 应用程序接口,但Python版的代码只有原来的50-60%,而且它们更容易阅读。</span><span id="zoom" class="a14c"><img title="pyqt.gif" border="0" alt="pyqt.gif" align="right" src="https://simg.open-open.com/show/fcdd517e76e14e17d34bb3d17ee04884.gif" width="90" height="90" /></span></p> <p><span id="zoom" class="a14c">与编程效率相关的是Python更容易学习,而且它足以满足富有经验的程序员。奇趣公司已经发现PyQt可以使他们向应用高端技术的团体出售Qt,这些团体的成员是工业专家(化学家,航空工程师等)而不是精深的C++程序员。</span></p> <p><span id="zoom" class="a14c">当然PyQt既成熟又稳定,并且有庞大的用户群体。我从用户那儿得到的两个最普通的反馈是“它恰到好处"和“它很不错。”<br /> <br /> <span style="font-weight:bold;">它拥有以下模块:</span><br /> </span></p> <p>PyQt4 contains the following Python modules.</p> <ul> <li>The <b>QtCore</b> module contains the core non-GUI classes, including the event loop and Qt's signal and slot mechanism. It also includes platform independent abstractions for Unicode, threads, mapped files, shared memory, regular expressions, and user and application settings.</li> <li>The <b>QtGui</b> module contains the majority of the GUI classes. These include a number of table, tree and list classes based on the model-view-controller design pattern. Also provided is a sophisticated 2D canvas widget capable of storing thousands of items including ordinary widgets.</li> <li>The <b>QtHelp</b> module contains classes for creating and viewing searchable documentation and being able to integrate online help with PyQt applications. It is based on the C++ port of the Lucene text search engine.</li> <li>The <b>QtNetwork</b> module contains classes for writing UDP and TCP clients and servers. It includes classes that implement FTP and HTTP clients and support DNS lookups. Network events are integrated with the event loop making it very easy to develop networked applications.</li> <li>The <b>QtOpenGL</b> module contains classes that enable the use of OpenGL in rendering 3D graphics in PyQt applications.</li> <li>The <b>QtScript</b> module contains classes that enable PyQt applications to be scripted using Qt's JavaScript interpreter.</li> <li>The <b>QtSql</b> module contains classes that integrate with open-source and proprietary SQL databases. It includes editable data models for database tables that can be used with GUI classes. It also includes an implementation of <a href="/misc/goto?guid=4958187574831218913">SQLite</a>.</li> <li>The <b>QtSvg</b> module contains classes for displaying the contents of SVG files. It supports the static features of SVG 1.2 Tiny.</li> <li>The <b>QtTest</b> module contains functions that enable unit testing of PyQt applications. PyQt does not implement the complete Qt unit test framework. Instead it assumes that the standard Python unit test framework will be used and implements those functions that simulate a user interacting with a GUI.</li> <li>The <b>QtWebKit</b> module implements a web browser engine based on the <a href="/misc/goto?guid=4958196951553640222">WebKit</a> open source browser engine used by Apple's Safari. It allows the methods and properties of Python objects to be published and appear as JavaScript objects to scripts embedded in HTML pages.</li> <li>The <b>QtXml</b> module implements SAX and DOM interfaces to Qt's XML parser.</li> <li>The <b>QtXmlPatterns</b> module implements XQuery and XPath support for XML and custom data models.</li> <li>The <b>phonon</b> module implements a multimedia framework that enables the use of audio and video content in PyQt applications. On Windows DirectX is used as the backend, on MacOS/X QuickTime is used as the backend, and on Linux GStreamer is used as the backend.</li> <li>The <b>QtMultimedia</b> module implements low-level multimedia functionality. Application developers would normally use the phonon module.</li> <li>The <b>QtAssistant</b> module implements a simple interface for integrating <i>Qt Assistant</i> with PyQt applications to provide online help. <i>Qt Assistant</i> is itself implemented using <b>QtHelp</b>.</li> <li>The <b>QtDesigner</b> module contains classes that allow <i>Qt Designer</i> to be extended using PyQt.</li> <li>The <b>QAxContainer</b> module implements access to ActiveX controls and COM objects. It is only available in the commercial version of PyQt for Windows.</li> <li>The <b>Qt</b> module consolidates the classes contained in all of the modules described above into a single module. This has the advantage that you don't have to worry about which underlying module contains a particular class. It has the disadvantage that it loads the whole of the Qt framework, thereby increasing the memory footprint of an application. Whether you use this consolidated module, or the individual component modules is down to personal taste.</li> <li>The <a href="/misc/goto?guid=4958196952287279758">DBus</a> support module is installed as <b>dbus.mainloop.qt</b>. PyQt does not support Qt's native DBus classes. Instead the module enables the Qt event loop to be used with the standard DBus Python bindings. It is only available for PyQt for X11.</li> <li>The <b>uic</b> module implements support for handling the XML files created by <i>Qt Designer</i> that describe the whole or part of a graphical user interface. It includes classes that load an XML file and render it directly, and classes that generate Python code from an XML file for later execution.</li> </ul> <p>PyQt also contains a number of utility programs.</p> <ul> <li><b>pyuic4</b> corresponds to the Qt <i>uic</i> utility. It converts GUIs created using <i>Qt Designer</i> to Python code.</li> <li><b>pyrcc4</b> corresponds to the Qt <i>rcc</i> utility. It embeds arbitrary resources (eg. icons, images, translation files) described by an XML resource collection file in a Python module. These resources can then be accessed from a PyQt application as files in a virtual filesystem.</li> <li><b>pylupdate4</b> corresponds to the Qt <i>lupdate</i> utility. It extracts all of the translatable strings from Python code and creates or updates translation files. These are then used by <i>Qt Linguist</i> to manage the translation of those strings.</li> </ul> <p><br /> <span id="zoom" class="a14c"><br /> </span>PyQt 4.8.6 发布了,这是一个很小的 bug 修复版本。<br /> <br /> 项目地址:<a href="/misc/goto?guid=4958183955441791537" target="_blank">http://www.riverbankcomputing.com/software/pyqt/intro</a></p> </div>