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
Related posts
- PyQt: How to pass arguments while emitting a signal — posted 2008-01-29
- PyQt4 QItemDelegate example with QListView and QAbstractListModel — posted 2008-01-23
- Python PyQt Tab Completion example — posted 2008-01-04
- How to capture the Tab key press event with PyQt 4.3 — posted 2008-01-03
- PyQt 4.3 Simple QAbstractListModel/ QlistView example — posted 2008-01-03
15
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.
#8 Pradeep commented on 2010-08-03:
Hii I am have suffering few problems in doing following assignment , please help me...
Qtprogram using python to calculate addition, subtraction.
please help me ...i am new in python
email id:pradeeppatil1101@gmail.com
#11 Umid commented on 2011-02-04:
On my ubuntu box, there are python2.6 and python3.1
When I installed PyQt4 it works for python2.6.
How to configure it for python3.1 too?
#13 AA commented on 2011-09-25:
After trying, the follow appears:
Depende: libqt4-designer (>= 4:4.7.0) mas não vai ser instalado Depende: libqt4-help (>= 4:4.7.0) mas não vai ser instalado Depende: libqt4-scripttools (>= 4:4.7.0) mas não vai ser instalado Depende: libqt4-test (>= 4:4.7.0) mas não vai ser instalado Depende: libqtassistantclient4 (>= 4.6.3) mas não vai ser instalado Depende: sip-api-8.1
After trying to install libqt4 it appears:
Depende: python-qt4 (>= 4.4) mas não vai ser instalado Depende: python-sqlalchemy (>= 0.4.3) mas não vai ser instalado Depende: python-beautifulsoup mas não vai ser instalado Recomenda: python-matplotlib mas não vai ser instalado
So, basically, one depends on the other, and none will install...
Thank you for the tips though...
#14 George Van Tuyl commented on 2012-01-08:
Worked just fine thank you. Ubuntu 11.1 Wheezy/sid 3.0.0-14-generic-pae i686
gvt
#15 Juuso commented on 2012-01-26:
If you are looking for pyqt designer, you should also add: apt-get install libqt4-dev qt4-dev-tools python-qt4-dev pyqt4-dev-tools
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
(5)
-
aws
(9)
-
blogproject
(20)
-
c_cplusplus
(12)
-
cardstore
(8)
-
colinux
(2)
-
concurrency
(13)
-
conkeror
(2)
-
core
(2)
-
cygwin
(17)
-
datastructures
(14)
-
datetime
(4)
-
decorators
(4)
-
django
(40)
-
emacs
(22)
-
files_directories
(11)
-
git
(5)
-
hardware
(5)
-
install_setup
(8)
-
javascript
(3)
-
keyboard
(9)
-
matplotlib
(5)
-
mercurial
(4)
-
nginx
(2)
-
persistence
(5)
-
preferences
(7)
-
processes
(4)
-
pyqt
(18)
-
python
(144)
-
ratpoison
(3)
-
regexes
(6)
-
rsync
(3)
-
softwaretools
(17)
-
sql
(14)
-
ssh
(10)
-
subversion
(6)
-
twisted
(7)
-
ubuntu
(65)
-
urxvt
(5)
-
vxworks
(25)
-
webdev
(5)
-
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
- Marty Alchin
- 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?