Help - Search - Members - Calendar
Full Version: Learning Pyqt
OESF Portables Forum > Everything Else > Archived Forums > Distros, Development, and Model Specific Forums > Zaurus - Everything Development > Python
Python plus PyQt is a great way to develop Zaurus apps. Python is (IMHO) much easier to learn and work with than C++, but Qt (the class library for Zaurus GUI apps that PyQt "wraps") has a bit of a learning curve. It's not difficult, but if you're just getting started, you'll likely need some references.

If you're new to Python, you'll want to get a handle on the basics of the language before you dive into any PyQt stuff. Dive Into Python is available both online and in hardcopy and provides an excellent introduction to Python for folks coming to Python with experience in other programming languages. The book teaches by example and does a pretty good job of zeroing in on core Python concepts.

Once you have a handle on Python basics, check out the book GUI Programming with Python: QT Edition by Boudewijn Rempt. You can read the whole book online at or snag a hardcopy from your favorite bookstore (ISBN: 0-97003300-4-4). This book is a tutorial that does a pretty good job of walking you through the basics of creating apps with Python and PyQt.

PyQt is a very "thin" wrapper around the Qt C++ class library. The Python classes in PyQt have a one-to-one correlation with the C++ classes in Qt. Trolltech's Qt Reference Documentation is outstanding. Every method in every class is documented and everything is nicely hyperlinked making it easy browse up and down the inheritance trees, type definitions, etc. It's not a tutorial, but once you understand the Qt basics, you can learn a lot by browsing this reference. Note that there are many versions of Qt. The link above takes you to the 2.3 docs which is what the Zaurus Qt libs are derived from.

Qtopia (also from Trolltech) is the GUI "shell" on the Zaurus. Qtopia is to Qt as Windows is to Win32. Qtopia extends some of the Qt base classes so that they pick up extra functionality on the Zaurus. For example the base class for a Qt application is QApplication but apps on the Zaurus should actually use the QPEApplication class from Qtopia. That's going to sound mighty confusing if you're not familiar with object oriented programming, but as you come up to speed on Qt development it will start to make sense. Trolltech has a Qtopia reference that you may find useful. That link is actually for the 1.6 version which is newer than the 1.5 version on the Zaurus. The 1.5 version docs appear to be long gone, but for most things the 1.6 docs are close enough.

There are probably lots of other good references and tutorial out there. Those are what I used. If you know of others that you think are worthwhile, post links in this topic.
When you are capable of reading and understanding german, then I'd like to recommend a fantastic german book called "Python und GUI-Toolkits" (Python and GUI Toolkits), MITP 2002, which contains information about GUI-Toolkits in general and how to create full fledged applications with the following toolkits:
  • Tkinter
  • wxPython
  • PyGTK-2
  • PyQt
The author describes how to seperate application logics from datekeeping and introduces a contact management application which is written with each one of the presented toolkits in a dedicated chapter. That way you not only learn a good deal about every individual toolkit, but you also learn what all toolkits have in common and what differences there are.

The chapter about PyQt can be used to learn writing PyQt applications on the Zaurus. You just need to substitute the QApplication object with a QPEApplication object.

Ok, enough for that shameless self promotion. tongue.gif

Unfortunately there is no english version - if I were to write another book like that, I would write it in english, since the german Python market is pretty small.
Thanks for the info guys. I wasn't sure what the difference between Qtopia and Qt was. Using widgets that aren't at an exact spot is a little weird for me (I'm used to Visual Basic), but it doesn't seem too bad.
I also want to recommend to purchase a copy of PyQtDoc from theKompany. It is a very good on-line reference for effective programming when using qt classes that are wrapped by PyQt.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.