Difference between revisions of "PyQt4 Lab 1"

From dftwiki3
Jump to: navigation, search
(New page: © D. Thiebaut 2009. This tutorial is a quick introduction to PyQt, a binding of Python with the Qt4 GUI library. Qt is made by [http://www.trolltech.com Trolltech] (now bought by No...)
 
Line 1: Line 1:
 
© D. Thiebaut 2009.
 
© D. Thiebaut 2009.
  
This tutorial is a quick introduction to PyQt, a binding of Python with the Qt4 GUI library.  Qt is made by [http://www.trolltech.com Trolltech] (now bought by Nokia), and is a powerful platform for developing GUI applications in C++ under Windows, MacOS, and Linux
+
This tutorial is a quick introduction to PyQt, a binding of Python with the Qt4 GUI library.  Qt was originally made by [http://www.trolltech.com Trolltech], now bought by Nokia, and is a powerful platform for developing GUI applications in C++ or Java for Windows, MacOS, and Linux, as well as embedded platforms.
 +
 
 +
This tutorial shows the basic steps for installing PyQt on a Windows XP machine (sorry, still not using and resisting using Vista), and creating a simple app.
 +
 
 +
=Installing PyQt=
 +
 
 +
* First install SIP which allows binding of C++ and python program.  SIP can be found at http://www.riverbankcomputing.co.uk/software/sip/download.  The last step of the installation gave me an error message, but this was for something relatively trivial which shouldn't influence the operation of the package.
 +
 
 +
* Then download and install PyQt4, also from Riverbank: http://www.riverbankcomputing.co.uk/software/pyqt/download .  As of today (2/1/09), this installs Python 2.6 on your system.  It may be different for you depending on when you install this package.
 +
 
 +
 
 +
* A test for verifying that your installation works
 +
 
 +
** Go '''Start/All Programs/Python 2.6/IDLE'''  (again, it may be a different version for you)
 +
** If the python shell window is not open, open it up ('''Run/Python Shell''')
 +
** Open a Python Shell window, and type
 +
 
 +
import PyQt4
 +
 
 +
::If you do not get an error message, then PyQt4 is installed correctly.
 +
 +
<center>[[Image:TutorialPyQt1.png]]</center>

Revision as of 11:29, 1 February 2009

© D. Thiebaut 2009.

This tutorial is a quick introduction to PyQt, a binding of Python with the Qt4 GUI library. Qt was originally made by Trolltech, now bought by Nokia, and is a powerful platform for developing GUI applications in C++ or Java for Windows, MacOS, and Linux, as well as embedded platforms.

This tutorial shows the basic steps for installing PyQt on a Windows XP machine (sorry, still not using and resisting using Vista), and creating a simple app.

Installing PyQt

  • First install SIP which allows binding of C++ and python program. SIP can be found at http://www.riverbankcomputing.co.uk/software/sip/download. The last step of the installation gave me an error message, but this was for something relatively trivial which shouldn't influence the operation of the package.


  • A test for verifying that your installation works
    • Go Start/All Programs/Python 2.6/IDLE (again, it may be a different version for you)
    • If the python shell window is not open, open it up (Run/Python Shell)
    • Open a Python Shell window, and type
import PyQt4
If you do not get an error message, then PyQt4 is installed correctly.
TutorialPyQt1.png