Python GUI Programming
A Complete Reference Guide
Develop responsive and powerful GUI applications with PyQt and Tkinter
Alan D. Moore
B. M. Harwani
BIRMINGHAM - MUMBAI
Python GUI Programming - A Complete Reference Guide
Copyright 2019 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors nor Packt Publishing or its dealers and distributors will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First Published: June 2019
Production Reference: 1200619
Published by Packt Publishing Ltd.
Livery Place, 35 Livery Street
Birmingham, B3 2PB, U.K.
ISBN 978-1-83898-847-0
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry-leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why Subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the Authors
Alan D. Moore is a data analyst and software developer who has been solving problems with Python since 2006. He's developed both open source and private code using frameworks like Django, Flask, Qt, and Tkinter. He contributes to various open source Python and Javascript projects. Alan maintains a blog by the name alandmoore, where he writes mainly about Python, Linux, free software, and his home studio recordings. Alan lives in Franklin, Tennessee, where he works for the county government, and with his wife, Cara, raises a crew of children who are just as geeky as their dad.
B. M. Harwani is founder and owner of Microchip Computer Education based in Ajmer, India that provides computer education in all programming and web developing platforms. Being involved in the teaching field for over 20 years, he has developed the art of explaining even the most complicated topics in a straightforward and easily understandable fashion. His latest books published include jQuery Recipes published by Apress, Introduction to Python Programming and Developing GUI Applications with PyQT published by Cengage Learning, The Android Tablet Developer's Cookbook published by Addison-Wesley Professional, UNIX & Shell Programming published by Oxford University Press, Qt5 Python GUI Programming Cookbook published by Packt.
Packt Is Searching for Authors Like You
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
A responsive graphical user interface (GUI) helps you interact with your application, improves user experience, and enhances the efficiency of your applications. With Python, youll have access to elaborate GUI frameworks that you can use to build interactive GUIs that stand apart from the rest.
This Learning Path begins by introducing you to Tkinter and PyQt, before guiding you through the application development process. As you expand your GUI by adding more widgets, you'll work with networks, databases, and graphical libraries that enhance its functionality. You'll also learn how to connect to external databases and network resources, test your code, and maximize performance using asynchronous programming. In later chapters, you'll understand how to use the cross-platform features of Tkinter and Qt5 to maintain compatibility across platforms. Youll be able to mimic the platform-native look and feel, and build executables for deployment across popular computing platforms.
By the end of this Learning Path, you'll have the skills and confidence to design and build high-end GUI applications that can solve real-world problems.
This Learning Path includes content from the following Packt products:
- Python GUI Programming with Tkinter by Alan D. Moore
- Qt5 Python GUI Programming Cookbook by B. M. Harwani
Who This Book Is For
If youre an intermediate Python programmer looking to enhance your coding skills by writing powerful GUIs in Python using PyQT and Tkinter, this is an ideal Learning Path for you. A strong understanding of the Python language is a must to grasp the concepts explained in this book.
What This Book Covers
, Introduction to Tkinter , introduces you to the basics of the Tkinter library and walks you through creating a Hello World application. It will also introduce you to IDLE as an example of a Tkinter application.
, Designing GUI Applications with Tkinter , goes through the process of turning a set of user requirements into a design that we can implement.
, Creating Basic Forms with Tkinter and ttk Widgets , shows you how to create a basic data entry form that appends data to a CSV file.
, Reducing User Error with Validation and Automation , demonstrates how to automatically populate and validate data in our form's inputs.
, Planning for the Expansion of Our Application , familiarizes you with how to break a small script into multiple files and build a Python module that you can import. It also contains some general advice on how to manage a larger code base.
, Creating Menus with Menu and Tkinter Dialogs , outlines the creation of a main menu using Tkinter. It will also show the use of several built-in dialog types to implement common menu functionality.
Next page