In an age when the term application developer nearly always implies web application developer, the building of desktop GUI applications may seem in danger of becoming a quaint and obscure art. Yet on every forum, mailing list, and chat service where programming is discussed, I find young Python coders eager to dive into GUI toolkits so that they can start building the kind of software that any average person can readily identify as an application. The one GUI library consistently recommended to these learners, the one that is arguably Python's most exciting and most complete toolkit, is PyQt.
Despite this popularity, there have been relatively few resources available for learning PyQt. Those who wish to learn it must rely heavily on outdated books, C++ documentation, scattered blogs, or snippets of code found in mailing lists or Stack Overflow posts. There is an apparent need for a modern tutorial and reference on PyQt for the Python programmer, and this book aims to fill that need.
My first book, Python GUI Programming with Tkinter, focused on the rudiments of application development using Tkinter, covering core topics such as interface design, unit testing, program architecture, and packaging. In this book, I wanted to go beyond the basics, not just teaching you how to build data-driven business forms (which so many toolkits can produce, and so many other books can teach you to write), but to explore the more exciting and unique possibilities offered by PyQt: multimedia, animation, 3D graphics, image manipulation, networking, multi-threading, and more. Of course, this book doesn't shirk the business side of things either, with solid coverage of data entry forms, SQL databases, and charting.
There are two kinds of authors who write technical books. The first is the absolute expert, with infallible authority and encyclopedic knowledge of the topic at hand, who is able to draw on a deep understanding to produce explanations that perfectly address the learner's most pertinent needs.
The second kind of author is a mere mortal possessed of a reasonable familiarity with the basics, a willingness to research what is not known, and most importantly, a dogged determination to ensure that every statement asserted in print is the whole and correct truth. This author must be prepared to stop mid-sentence in the flow of writing to test claims in the interpreter or code editor; to spend hours reading documentation, mailing-list threads, code comments, and IRC logs in the pursuit of a more correct understanding; and to delete and rewrite large swathes of their work when a new fact reveals a fault in their original assumptions.
When I was asked to write a book on PyQt5, I could make no claims to being the first sort of author (nor can I now); while I had developed and maintained several PyQt applications both at work and in the open source world, my understanding of PyQt rarely strayed beyond the simple needs of my own code. So, I have aspired to be the second type, committing myself to diligent study and the painstaking process of sifting and distilling the tangled mass of available information into a text that might guide the aspiring GUI programmer toward mastery of PyQt.
As a proud father of five children, some of whom have a budding (if not blooming) interest in programming, I have worked these past six months to write a book that I could confidently and conscientiously put before them, should they wish to learn these skills. I hope, dear reader, that you sense in this text this parental enthusiasm for your growth and progress as we tackle this subject together.