Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Python GUI Programming with Tkinter, 2nd edition - Second Edition
Python GUI Programming with Tkinter, 2nd edition - Second Edition

Python GUI Programming with Tkinter, 2nd edition: Design and build functional and user-friendly GUI applications, Second Edition

By Alan D. Moore
$39.99 $27.98
Book Oct 2021 664 pages 2nd Edition
eBook
$39.99 $27.98
Print
$49.99
Subscription
$15.99 Monthly
eBook
$39.99 $27.98
Print
$49.99
Subscription
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Oct 28, 2021
Length 664 pages
Edition : 2nd Edition
Language : English
ISBN-13 : 9781801815925
Category :
Table of content icon View table of contents Preview book icon Preview Book

Python GUI Programming with Tkinter, 2nd edition - Second Edition

Introduction to Tkinter

Welcome, Python coder! If you've learned the basics of Python and want to start designing powerful GUI applications, this book is for you.

By now, you have no doubt experienced the power and simplicity of Python. Perhaps you've written web services, performed data analysis, or administered servers. Perhaps you've written a game, automated routine tasks, or simply played around with code. But now you're ready to tackle the GUI.

With so much emphasis on web, mobile, and server-side programming, the development of simple desktop GUI applications seems increasingly like a lost art; many otherwise experienced developers have never learned to create one. What a tragedy! Desktop computers still play a vital role in work and home computing, and the ability to build simple, functional applications for this ubiquitous platform should be a part of every software developer's toolbox. Fortunately, for Python coders, that ability is well...

Introducing Tkinter and Tk

The Tk widget library originates from the Tool Command Language (Tcl) programming language. Tcl and Tk were created by John Ousterhout while he was a professor at Berkeley in the late 1980s as an easier way to program the engineering tools being used at the university. Because of its speed and relative simplicity, Tcl/Tk rapidly grew in popularity among academic, engineering, and Unix programmers. Much like Python itself, Tcl/Tk originated on the Unix platform and only later migrated to macOS and Windows. Tk's practical intent and Unix roots still inform its design today, and its simplicity compared to other toolkits is still a major strength.

Tkinter is a Python interface to the Tk GUI library and has been a part of the Python standard library since 1994 with the release of Python version 1.1, making it the de-facto GUI library for Python. Documentation for Tkinter, along with links for further study, can be found in the standard library documentation...

An overview of basic Tkinter

As exciting as it may be to see that first GUI window pop up on the screen, "Hello World" is not a terribly interesting application. Let's start again and dig a little deeper into Tkinter as we build a slightly larger program. Since the next chapter will see you landing a job at a fictitious agricultural laboratory studying fruit plants, let's create a little program to gauge your opinions about bananas.

Building a GUI with Tkinter widgets

Start a new file in your editor called banana_survey.py, and begin by importing tkinter like so:

# banana_survey.py
"""A banana preferences survey written in Python with Tkinter"""
import tkinter as tk

As with hello_tkinter.py, we need to create a root window before we can create any widgets or other Tkinter objects:

root = tk.Tk()

Once again, we've called this object root. The root window can be configured in various ways; for example,...

Summary

In this chapter, you learned how to install Tkinter and IDLE, and you've gotten a taste of how easy it is to start building a GUI with Tkinter. You learned how to create widgets, how to arrange them in the main window with the grid() geometry manager, and how to bind their contents to control variables like StringVar and BooleanVar. You also learned how to bind events like button clicks to callback functions, and how to retrieve and process widget data.

In the next chapter, you'll start your new job at ABQ AgriLabs and be presented with a problem that will require your GUI programming skills. You will learn how to dissect this problem, develop a program specification, and design a user-friendly application that will be part of the solution.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Extensively revised with new content on RESTful networking, classes in Tkinter, and the Notebook widget
  • Take advantage of Tkinter’s lightweight, portable, and easy-to-use features
  • Build better-organized code and learn to manage an evolving codebase

Description

Tkinter is widely used to build GUIs in Python due to its simplicity. In this book, you’ll discover Tkinter’s strengths and overcome its challenges as you learn to develop fully featured GUI applications. Python GUI Programming with Tkinter, Second Edition, will not only provide you with a working knowledge of the Tkinter GUI library, but also a valuable set of skills that will enable you to plan, implement, and maintain larger applications. You’ll build a full-blown data entry application from scratch, learning how to grow and improve your code in response to continually changing user and business needs. You’ll develop a practical understanding of tools and techniques used to manage this evolving codebase and go beyond the default Tkinter widget capabilities. You’ll implement version control and unit testing, separation of concerns through the MVC design pattern, and object-oriented programming to organize your code more cleanly. You’ll also gain experience with technologies often used in workplace applications, such as SQL databases, network services, and data visualization libraries. Finally, you’ll package your application for wider distribution and tackle the challenge of maintaining cross-platform compatibility.

What you will learn

Produce well-organized, functional, and responsive GUI applications Extend the functionality of existing widgets using classes and OOP Plan wisely for the expansion of your app using MVC and version control Make sure your app works as intended through widget validation and unit testing Use tools and processes to analyze and respond to user requests Become familiar with technologies used in workplace applications, including SQL, HTTP, Matplotlib, threading, and CSV Use PostgreSQL authentication to ensure data security for your application

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Oct 28, 2021
Length 664 pages
Edition : 2nd Edition
Language : English
ISBN-13 : 9781801815925
Category :

Table of Contents

22 Chapters
Preface Chevron down icon Chevron up icon
Introduction to Tkinter Chevron down icon Chevron up icon
Designing GUI Applications Chevron down icon Chevron up icon
Creating Basic Forms with Tkinter and Ttk Widgets Chevron down icon Chevron up icon
Organizing Our Code with Classes Chevron down icon Chevron up icon
Reducing User Error with Validation and Automation Chevron down icon Chevron up icon
Planning for the Expansion of Our Application Chevron down icon Chevron up icon
Creating Menus with Menu and Tkinter Dialogs Chevron down icon Chevron up icon
Navigating Records with Treeview and Notebook Chevron down icon Chevron up icon
Improving the Look with Styles and Themes Chevron down icon Chevron up icon
Maintaining Cross-Platform Compatibility Chevron down icon Chevron up icon
Creating Automated Tests with unittest Chevron down icon Chevron up icon
Improving Data Storage with SQL Chevron down icon Chevron up icon
Connecting to the Cloud Chevron down icon Chevron up icon
Asynchronous Programming with Thread and Queue Chevron down icon Chevron up icon
Visualizing Data Using the Canvas Widget Chevron down icon Chevron up icon
Packaging with setuptools and cxFreeze Chevron down icon Chevron up icon
A: A Quick Primer on reStructuredText Chevron down icon Chevron up icon
B: A Quick SQL Tutorial Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Appendices Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(2 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


John Campbell Feb 12, 2024
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Would like the book much better if it didn't have 'Trade-Pub' emblazoned on every page. Makes it very difficult to read. If you want to do this again in the future, I would much prefer having a full page disclaimer at the beginning and/or ending of the book saying something like 'Courtesy of Trade-Pub' or 'Thanks from Trade-Pub' etc. But don't have the stencil on every page in the book!
Feefo Verified review Feefo image
eijiro wakabayashi Dec 7, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Feefo Verified review Feefo image
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.