How to install pyqt4 on ubuntu linux
Install and run "hello world" example
apt-cache search pyqt
sudo apt-get install python-qt4
- Create a file
~/tmp/helloworld.pyimport sys from PyQt4.QtGui import * app = QApplication(sys.argv) button = QPushButton("Hello World", None) button.show() app.exec_()
- Run it:
python ~/tmp/helloworld.py
You should see a window with a single button pop up.
Install additional examples
- For more examples, install the
python-qt4-docpackage:sudo apt-get install python-qt4-doc
- After installation, the examples are located at:
/usr/share/doc/python-qt4-doc/examples
7
Comments
—
Comments feed for this post
#2 Eliot commented on 2008-09-28:
pamchi,
I've update the post to include some more information. Good luck!
#3 B commented on 2008-10-02:
it's somewhat odd, but it seems like the python-qt4 package is missing some parts. specifically, I've run into two so far: setTimeSpec from QDateTimeEdit and setHeaderHidden from QTreeView. Both of these are in the docs, so I guess to use them you need to do a manual install? Unless the next release fixes this.
#4 Eliot commented on 2008-10-02:
B, the python-qt4 package in Ubuntu Hardy provides PyQt 4.3. However, currently, the latest version is PyQt 4.4. You were probably looking at the docs for 4.4. To get the latest version, you can install it manually (I don't think it is very hard). Or, if you can wait a month, Ubuntu Intrepid will include PyQt 4.4.
#5 Robert commented on 2008-10-05:
I'm trying to get Thin Liquid Film running on my Intrepid Ibex installation. However, when I try installing it, it tells me that I'm missing pyqt.
I loaded Synaptic and have installed the python-qt4 package (version 4.4.3-1ubuntu1) which includes the libqtcore package version 4.4.3-0ubuntu1 and python-bindings version 4.4.3-1ubuntu1.
Any ideas why its not installing?
Robert
#6 Robert commented on 2008-10-05:
Answering my own question. Apparently TLF is specifically looking for QT3. Guess they haven't updated their program as of yet.
#7 trish commented on 2010-01-02:
It worked fine for me. Great example of a small qt program. i am impressed.
Post a comment
About
I'm Eliot and this is my notepad for programming topics such as Python, Django, Ubuntu, Emacs, etc... more »
Search Blog
Tags
-
algorithms
(4)
-
aws
(8)
-
blogproject
(20)
-
c_cplusplus
(12)
-
cardstore
(8)
-
colinux
(2)
-
concurrency
(9)
-
conkeror
(2)
-
cygwin
(18)
-
datastructures
(15)
-
datetime
(3)
-
dell
(3)
-
django
(39)
-
emacs
(20)
-
files_directories
(10)
-
install_setup
(7)
-
javascript
(3)
-
keyboard
(6)
-
matplotlib
(5)
-
mercurial
(4)
-
nginx
(2)
-
preferences
(8)
-
processes
(3)
-
pyqt
(18)
-
python
(122)
-
ratpoison
(3)
-
regexes
(5)
-
rsync
(3)
-
softwaretools
(17)
-
sql
(13)
-
ssh
(7)
-
subversion
(6)
-
twisted
(6)
-
ubuntu
(60)
-
urxvt
(5)
-
vxworks
(25)
-
webservices
(4)
-
wmii
(7)
Blogroll
- Adam Gomaa
- Alex Clemesha
- Amir Salihefendic
- Armin Ronacher
- David Beazley
- David Ziegler
- Duncan McGreggor
- Gareth Rushgrave
- Glyph Lefkowitz
- Guido van Rossum
- Ian Bicking
- Jacob Kaplan-Moss
- James Bennett
- James Tauber
- Jesper Noehr
- Matt Harrison
- Nikolay Kolev
- Parand Darugar
- Peter Baumgartner
- Peter Bengtsson
- Rob Hudson
- Simon Willison
- Will McGugan
#1 pamchi commented on 2008-09-28:
And then??? i do that but it doesn't work... :( what can i do?