File: introduction.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (270 lines) | stat: -rw-r--r-- 17,743 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Introduction &#8212; PyQt 4.12.1 Reference Guide</title>
    
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '4.12.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true,
        SOURCELINK_SUFFIX: '.txt'
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="shortcut icon" href="_static/logo_tn.ico"/>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Potential Incompatibilities with Earlier Versions" href="incompatibilities.html" />
    <link rel="prev" title="PyQt4 Reference Guide" href="index.html" /> 
  </head>
  <body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="incompatibilities.html" title="Potential Incompatibilities with Earlier Versions"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="PyQt4 Reference Guide"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">PyQt 4.12.1 Reference Guide</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="introduction">
<h1>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h1>
<p>This is the reference guide for PyQt4 4.12.1.  PyQt4 is a set of
<a class="reference external" href="http://www.python.org">Python</a> bindings for v4 and v5 of the Qt application
framework from <a class="reference external" href="http://qt.digia.com">Digia</a>.</p>
<p>There is a separate <a class="reference external" href="classes.html">PyQt4 Class Reference</a>.</p>
<p>Qt is a set of C++ libraries and development tools that includes platform
independent abstractions for graphical user interfaces, networking, threads,
Unicode, regular expressions, SQL databases, SVG, OpenGL, XML, and user and
application settings.  PyQt4 implements 440 of these classes as a set of
Python modules.</p>
<p>PyQt4 supports the Windows, Linux, UNIX and MacOS/X platforms.</p>
<p>PyQt4 does not include Qt itself - you must obtain it separately.</p>
<p>The homepage for PyQt4 is <a class="reference external" href="http://www.riverbankcomputing.com/software/pyqt/">http://www.riverbankcomputing.com/software/pyqt/</a>.
Here you will always find the latest stable version, current development
previews, and the latest version of this documentation.</p>
<p>PyQt4 is built using the <a class="reference external" href="http://www.riverbankcomputing.com/software/sip/">SIP bindings generator</a>.  SIP must be installed in
order to build and use PyQt4.</p>
<p>Earlier versions of Qt are supported by PyQt v3.</p>
<div class="section" id="license">
<h2>License<a class="headerlink" href="#license" title="Permalink to this headline">¶</a></h2>
<p>PyQt4 is dual licensed on all platforms under the Riverbank Commercial License
and the GPL v3.  Your PyQt4 license must be compatible with your Qt license.
If you use the GPL versions then your own code must also use a compatible
license.</p>
<p>PyQt4, unlike Qt, is not available under the LGPL.</p>
<p>You can purchase a commercial PyQt4 license <a class="reference external" href="http://www.riverbankcomputing.com/commercial/buy">here</a>.</p>
</div>
<div class="section" id="pyqt4-components">
<h2>PyQt4 Components<a class="headerlink" href="#pyqt4-components" title="Permalink to this headline">¶</a></h2>
<p>PyQt4 comprises a number of different components.  First of all there are a
number of Python extension modules.  These are all installed in the
<code class="xref py py-mod docutils literal"><span class="pre">PyQt4</span></code> Python package.</p>
<ul class="simple">
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtCore</span></code> module.  This 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 <code class="xref py py-mod docutils literal"><span class="pre">QtGui</span></code> module.  This contains the majority of the GUI
classes.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtHelp</span></code> module.  This contains classes for creating and
viewing searchable documentation.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtNetwork</span></code> module.  This module contains classes for writing
UDP and TCP clients and servers.  It includes classes that implement FTP and
HTTP clients and support DNS lookups.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtOpenGL</span></code> module.  This module contains classes that enable
the use of OpenGL in rendering 3D graphics in PyQt4 applications.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtScript</span></code> module.  This module contains classes that enable
PyQt4 applications to be scripted using Qt’s JavaScript interpreter.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtScriptTools</span></code> module.  This module contains classes that
contain additional components (e.g. a debugger) that are used with Qt’s
JavaScript interpreter.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtSql</span></code> module.  This module contains classes that integrate
with SQL databases.  It includes editable data models for database tables
that can be used with GUI classes.  It also includes an implementation of
<a class="reference external" href="http://www.sqlite.org">SQLite</a>.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtSvg</span></code> module.  This module contains classes for displaying
the contents of SVG files.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtTest</span></code> module.  This module contains functions that enable
unit testing of PyQt4 applications.  (PyQt4 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 <code class="xref py py-mod docutils literal"><span class="pre">QtWebKit</span></code> module.  This module implements a web browser
engine based on the WebKit open source browser engine.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtXml</span></code> module.  This module contains classes that implement
SAX and DOM interfaces to Qt’s XML parser.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtXmlPatterns</span></code> module.  This module contains classes that
implement XQuery and XPath support for XML and custom data models.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">phonon</span></code> module.  This module contains classes that implement
a cross-platform multimedia framework that enables the use of audio and video
content in PyQt4 applications.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtDBus</span></code> module.  This Unix-only module provides classes that
support Inter-Process Communication using the D-Bus protocol.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtDeclarative</span></code> module.  This module provides a declarative
framework for building highly dynamic, custom user interfaces using QML.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtMultimedia</span></code> module.  This module provides low-level
multimedia functionality.  Application developers would normally use the
<code class="xref py py-mod docutils literal"><span class="pre">phonon</span></code> module.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtAssistant</span></code> module.  This module contains classes that
allow Qt Assistant to be integrated with a PyQt4 application to provide
online help.  This module is not available with Qt v4.7 and later - use the
<code class="xref py py-mod docutils literal"><span class="pre">QtHelp</span></code> module instead.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QtDesigner</span></code> module.  This module contains classes that allow
Qt Designer to be extended using PyQt4.  See <a class="reference internal" href="designer.html#ref-designer-plugins"><span class="std std-ref">Writing Qt Designer Plugins</span></a> for
a full description of how to do this.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">QAxContainer</span></code> module.  This Windows-only module contains
classes that allow access to ActiveX controls and COM objects.</li>
<li>The <code class="xref py py-mod docutils literal"><span class="pre">Qt</span></code> module.  This 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 class="reference external" href="http://www.freedesktop.org/wiki/Software/DBusBindings">DBus</a> support
module is installed as <code class="xref py py-mod docutils literal"><span class="pre">dbus.mainloop.qt</span></code>.  This module provides support
for the Qt event loop in the same way that the <code class="xref py py-mod docutils literal"><span class="pre">dbus.mainloop.glib</span></code>
included with the standard <code class="docutils literal"><span class="pre">dbus-python</span></code> bindings package provides support
for the GLib event loop.  The API is described in <a class="reference internal" href="dbus.html#ref-dbus"><span class="std std-ref">DBus Support</span></a>.  It is
only available if the <code class="docutils literal"><span class="pre">dbus-python</span></code> v0.80 (or later) bindings package is
installed.  The <code class="xref py py-mod docutils literal"><span class="pre">QtDBus</span></code> module provides a more Qt-like interface
to DBus.</li>
<li>The <a class="reference internal" href="designer.html#module-PyQt4.uic" title="PyQt4.uic"><code class="xref py py-mod docutils literal"><span class="pre">uic</span></code></a> module.  This module contains classes for handling the
<code class="docutils literal"><span class="pre">.ui</span></code> files created by Qt Designer that describe the whole or part of a
graphical user interface.  It includes classes that load a <code class="docutils literal"><span class="pre">.ui</span></code> file and
render it directly, and classes that generate Python code from a <code class="docutils literal"><span class="pre">.ui</span></code> file
for later execution.</li>
<li>The <a class="reference internal" href="build_system.html#module-PyQt4.pyqtconfig" title="PyQt4.pyqtconfig"><code class="xref py py-mod docutils literal"><span class="pre">pyqtconfig</span></code></a> module is an extention of the SIP build system
and is created when PyQt4 is configured.  It encapsulates all the necessary
information about your Qt installation and makes it easier to write
installation scripts for bindings built on top of PyQt4.  It is covered in
detail in <a class="reference internal" href="build_system.html#ref-build-system"><span class="std std-ref">The PyQt4 Build System</span></a>.</li>
</ul>
<p>PyQt4 also contains a number of utility programs.</p>
<ul>
<li><p class="first"><strong class="program">pyuic4</strong> corresponds to the Qt <strong class="program">uic</strong> utility.  It converts
GUIs created using Qt Designer to Python code.</p>
</li>
<li><p class="first"><strong class="program">pyrcc4</strong> corresponds to the Qt <strong class="program">rcc</strong> utility.  It embeds
arbitrary resources (eg. icons, images, translation files) described by a
resource collection file in a Python module.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">It will only be included if your copy of Qt includes the XML module.</p>
</div>
</li>
<li><p class="first"><strong class="program">pylupdate4</strong> corresponds to the Qt <strong class="program">lupdate</strong> utility.  It
extracts all of the translatable strings from Python code and creates or
updates <code class="docutils literal"><span class="pre">.ts</span></code> translation files.  These are then used by Qt Linguist to
manage the translation of those strings.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">It will only be included if your copy of Qt includes the XML module.</p>
</div>
</li>
</ul>
<p>When PyQt4 is configured a file called <code class="file docutils literal"><span class="pre">PyQt4.api</span></code> is generated.  This
can be used by the QScintilla editor component (at
<a class="reference external" href="http://www.riverbankcomputing.com/software/qscintilla/">http://www.riverbankcomputing.com/software/qscintilla/</a>) to enable the use of
auto-completion and call tips when editing PyQt4 code.  The API file is
installed automatically if QScintilla is already installed.</p>
<p>PyQt4 includes a large number of examples.  These are ports to Python of many
of the C++ examples provided with Qt.  They can be found in the
<code class="file docutils literal"><span class="pre">examples</span></code> directory.</p>
<p>Finally, PyQt4 contains the <code class="docutils literal"><span class="pre">.sip</span></code> files used by SIP to generate PyQt4
itself.  These can be used by developers of bindings of other Qt based class
libraries - for example <a class="reference external" href="http://pyqwt.sourceforge.net/">PyQwt and PyQwt3D</a>.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/logo.png" alt="Logo"/>
            </a></p>
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Introduction</a><ul>
<li><a class="reference internal" href="#license">License</a></li>
<li><a class="reference internal" href="#pyqt4-components">PyQt4 Components</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="index.html"
                        title="previous chapter">PyQt4 Reference Guide</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="incompatibilities.html"
                        title="next chapter">Potential Incompatibilities with Earlier Versions</a></p>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="incompatibilities.html" title="Potential Incompatibilities with Earlier Versions"
             >next</a> |</li>
        <li class="right" >
          <a href="index.html" title="PyQt4 Reference Guide"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">PyQt 4.12.1 Reference Guide</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2016 Riverbank Computing Limited.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.2.
    </div>
  </body>
</html>