Buscar en Mind w/o Soul

miércoles, abril 30, 2008

Python PyQt4 Tutorial


Europython 2006 (03-05 July 2006)
PyQt4 is a set of bindings for Qt 4, a cross-platform C++ framework used to make graphical user interface (GUI) applications. With the release of PyQt4, Python developers are now able to develop powerful cross-platform applications and deploy them under the GNU General Public License (GPL) or the Qt Commercial License on all platforms that support Qt and Python. We will first briefly discuss PyQt (for Qt 3) and PyKDE (bindings for the K Desktop Environment), and take a look at what has changed in PyQt4. The main part of the presentation will cover the new possibilities that PyQt4 offers developers, including access to Qt's rich text handling features, sophisticated data handling controls, internationalization support, and integration with the Qt Designer GUI design tool.


Introduction to PyQT4
Creating an application in PyQT4 may be done in a few ways. The most common one is to use QTDesigner, which we get with QT. QTDesigner let us draw the GUI which is very handy for complicated interfaces. We can place widgets on the window, add names etc. To create an application in PyQT4 you have to:

* Create the GUI in QTDesigner
* Set names in the Property Editor to ease coding of the application (QTDesigner)
* Using pyuic4 create the python GUI class
* Call the application using that GUI class
* Extend it with our own slots
* When you use a widget you go to PyQt's Classes and check methods of each used widgets. The method names as "setText" are very easy to understand :nice:

No hay comentarios: