Book Image

Python GUI Programming - A Complete Reference Guide

By : Alan D. Moore, B. M. Harwani
Book Image

Python GUI Programming - A Complete Reference Guide

By: Alan D. Moore, B. M. Harwani

Overview of this book

A responsive graphical user interface (GUI) helps you interact with your application, improves user experience, and enhances the efficiency of your applications. With Python, you’ll 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. You’ll 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
Table of Contents (28 chapters)
Title Page

What This Book Covers

Chapter 1Introduction 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.

Chapter 2, Designing GUI Applications with Tkinter, goes through the process of turning a set of user requirements into a design that we can implement.

Chapter 3, 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.

Chapter 4, Reducing User Error with Validation and Automation, demonstrates how to automatically populate and validate data in our form's inputs.  

Chapter 5, 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.

Chapter 6, 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.

Chapter 7, Navigating Records with Treeview, details the construction of a records navigation system using the Tkinter Treeview and the conversion of our application from append-only to full read, write, and update capabilities.

Chapter 8Improving the Look with Styles and Themes, informs you of how to change the colors, fonts, and widget styles of your application, and how to use them to make your application more usable.

Chapter 9, Creating Automated Tests with unittest, discusses how to verify your code with automated unit tests and integration tests.

Chapter 10, Improving Data Storage with SQL, takes you through the conversion of our application from the CSV flat-files to SQL data storage. You'll learn all about SQL and relational data models as well.

Chapter 11, Connecting to the Cloud, covers how to work with cloud services such as web services and FTP to download and upload data.

Chapter 12, Visualizing Data Using the Canvas Widget, teaches you how to work with the Tkinter Canvas widget to create visualizations and animations.

Chapter 13, Creating a User Interface with Qt Components, teaches you to use certain basic widgets of Qt Designer and how to display a welcome message along with the username. You will learn how to choose one out of several options using radio buttons and choose more than one out of several options by making use of checkboxes.

Chapter 14, Event Handling – Signals and Slots, covers how to execute specific tasks on the occurrence of certain events on any widget, as well as how to copy and paste text from one Line Edit widget to another, convert data types and make a small calculator, and use spin boxes, scrollbars, and sliders. You will also learn to perform multiple tasks using the List Widget.

Chapter 15, Understanding OOP Concepts, discusses object-oriented programming concepts such as how to use classes, single inheritance, multilevel inheritance in GUI applications, and multiple inheritance.

Chapter 16, Understanding Dialogs, explores the use of certain dialogs, where each dialog is meant for fetching a different kind of information. You will also learn to take input from the user using input dialog.

Chapter 17, Understanding Layouts, explains how to arrange widgets horizontally, vertically, and in different layouts by making use of Horizontal Layout, Vertical Layout, Grid Layout, as well as how to arrange widgets in two column layout using Form Layout.

Chapter 18, Networking and Managing Large Documents, demonstrates how to make a small browser, establish a connection between client and server, create a dockable and floatable sign in form, and manage more than one document using MDI. Also, you will learn how to display information in sections using the Tab widget, and how to create a custom menu bar that invokes different graphics tools when a specific menu item is chosen.

Chapter 19, Database Handling, outlines how to manage a SQLite database to keep information for future use. Using the knowledge gained, you will learn to make a signin form that checks whether a user's email address and password are correct or not.

Chapter 20, Using Graphics, explains how to display certain graphics in the application. You will also learn how to create a toolbar of your own that contains certain tools that can be used to draw different graphics.

Chapter 21, Implementing Animation, features how to display a 2D graphical image, make a ball move down on the click of a button, make a bouncing ball, and make a ball animate as per the specified curve.

Chapter 22, Using Google Maps, showcases how to use the Google API to display location and other information. You will learn to derive the distance between two locations and display location on Google Maps on the basis of longitude and latitude values that are entered.