Book description
Over 90 recipes to help you develop widgets, forms, layouts, charts, and much more using the latest features of Python 3
Key Features
- Use object-oriented programming to develop impressive GUIs in Python
- Create interesting charts to visually represent data using Matplotlib
- Develop GUIs with the latest versions of tkinter, PyQt5, and wxPython frameworks
Book Description
Python is a multi-domain, interpreted programming language that is easy to learn and implement. With its wide support for frameworks to develop GUIs, you can build interactive and beautiful GUI-based applications easily using Python. This third edition of Python GUI Programming Cookbook follows a task-based approach to help you create effective GUIs with the smallest amount of code. Every recipe in this book builds upon the last to create an entire, real-life GUI application. These recipes also help you solve problems that you might encounter while developing GUIs. This book mainly focuses on using Python's built-in tkinter GUI framework. You'll learn how to create GUIs in Python using simple programming styles and object-oriented programming (OOP). As you add more widgets and expand your GUI, you will learn how to connect to networks, databases, and graphical libraries that greatly enhance the functionality of your GUI. You'll also learn how to use threading to ensure that your GUI doesn't become unresponsive. Toward the end, you'll learn about the versatile PyQt GUI framework, which comes along with its own visual editor that allows you to design GUIs using drag and drop features. By the end of the book, you'll be an expert in designing Python GUIs and be able to develop a variety of GUI applications with ease.
What you will learn
- Create amazing GUIs with Python's built-in tkinter module
- Customize GUIs using layout managers to arrange GUI widgets
- Advance from the typical waterfall coding style to an OOP style using Python
- Develop beautiful charts using the free Matplotlib Python module
- Use threading in a networked environment to make GUIs responsive
- Discover ways to connect GUIs to a MySQL database
- Understand how unit tests can be created and internationalize GUI
- Delve into the world of GUI creation using PyQt5
Who this book is for
If you're a programmer or developer looking to enhance your Python skills by writing powerful GUI applications, this book is for you. Familiarity with the Python programming language is necessary to get the most out of the book.
Table of contents
- Title Page
- Copyright and Credits
- About Packt
- Contributors
- Preface
-
Creating the GUI Form and Adding Widgets
- Creating our first Python GUI
- Preventing the GUI from being resized
- Adding a label to the GUI form
- Creating buttons and changing their text attributes
- Creating textbox widgets
- Setting the focus to a widget and disabling widgets
- Creating combobox widgets
- Creating a check button with different initial states
- Using radio button widgets
- Using scrolled text widgets
- Adding several widgets in a loop
- Layout Management
-
Look and Feel Customization
- Creating message boxes – information, warning, and error
- How to create independent message boxes
- How to create the title of a tkinter window form
- Changing the icon of the main root window
- Using a spin box control
- Applying relief – the sunken and raised appearance of widgets
- Creating tooltips using Python
- Adding Progressbar to the GUI
- How to use the canvas widget
- Data and Classes
- Matplotlib Charts
- Threads and Networking
- Storing Data in Our MySQL Database via Our GUI
-
Internationalization and Testing
- Displaying widget text in different languages
- Changing the entire GUI language all at once
- Localizing the GUI
- Preparing the GUI for internationalization
- How to design a GUI in an agile fashion
- Do we need to test the GUI code?
- Setting debug watches
- Configuring different debug output levels
- Creating self-testing code using Python's __main__ section
- Creating robust GUIs using unit tests
- How to write unit tests using the Eclipse PyDev IDE
-
Extending Our GUI with the wxPython Library
- Installing the wxPython library
- Creating our GUI in wxPython
- Quickly adding controls using wxPython
- Trying to embed a main wxPython app in a main tkinter app
- Trying to embed our tkinter GUI code into wxPython
- Using Python to control two different GUI frameworks
- Communicating between the two connected GUIs
-
Building GUIs with PyQt5
- Installing PyQt5
- Installing the PyQt5 Designer tool
- Writing our first PyQt5 GUI
- Changing the title of the GUI
- Refactoring our code into object-oriented programming
- Inheriting from QMainWindow
- Adding a status bar widget
- Adding a menu bar widget
- Starting the PyQt5 Designer tool
- Previewing the form within the PyQt5 Designer
- Saving the PyQt5 Designer form
- Converting Designer .ui code into .py code
- Understanding the converted Designer code
- Building a modular GUI design
- Adding another menu item to our menu bar
- Connecting functionality to the Exit menu item
- Adding a Tab Widget via the Designer
- Using layouts in the Designer
- Adding buttons and labels in the Designer
- Best Practices
- Other Books You May Enjoy
Product information
- Title: Python GUI Programming Cookbook - Third Edition
- Author(s):
- Release date: October 2019
- Publisher(s): Packt Publishing
- ISBN: 9781838827540
You might also like
book
Qt5 Python GUI Programming Cookbook
Over 60 recipes to help you design interactive, smart, and cross-platform GUI applications Key Features Get …
book
Python 3 Object-Oriented Programming. - Third Edition
Uncover modern Python with this guide to Python data structures, design patterns, and effective object-oriented techniques …
book
Python GUI Programming - A Complete Reference Guide
Explore Python's GUI frameworks and create visually stunning and feature-rich applications Key Features Integrate stunning data …
book
Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming
The Insider’s Best-Practice Guide to Rapid PyQt 4 GUI Development Whether you’re building GUI prototypes or …