Book Image

Tkinter GUI Application Development Blueprints - Second Edition

By : Bhaskar Chaudhary
Book Image

Tkinter GUI Application Development Blueprints - Second Edition

By: Bhaskar Chaudhary

Overview of this book

Tkinter is the built-in GUI package that comes with standard Python distributions. It is a cross-platform package, which means you build once and deploy everywhere. It is simple to use and intuitive in nature, making it suitable for programmers and non-programmers alike. This book will help you master the art of GUI programming. It delivers the bigger picture of GUI programming by building real-world, productive, and fun applications such as a text editor, drum machine, game of chess, audio player, drawing application, piano tutor, chat application, screen saver, port scanner, and much more. In every project, you will build on the skills acquired in the previous project and gain more expertise. You will learn to write multithreaded programs, network programs, database-driven programs, asyncio based programming and more. You will also get to know the modern best practices involved in writing GUI apps. With its rich source of sample code, you can build upon the knowledge gained with this book and use it in your own projects in the discipline of your choice.
Table of Contents (12 chapters)

To get the most out of this book

We assume an introductory level familiarity with the basic constructs of Python programming language. We use Python version 3.6 with Tkinter 8.6, and it is recommended to stick to these exact versions to avoid compatibility issues.

The programs discussed in this book have been developed on the Linux Mint platform. However, given the multiplatform abilities of Tkinter, you can easily work on other platforms such as Windows, Mac OS, and other distributions of Linux. The links to download and install other project-specific modules and software are mentioned in the respective chapters.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packtpub.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Tkinter-GUI-Application-Development-Blueprints-Second-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example:

"The reset_to_initial_locations() method initializes all the locations to reflect the starting position of the game."

A block of code is set as follows:

def toggle_play_button_state(self):
if self.now_playing:
self.play_button.config(state="disabled")
else:
self.play_button.config(state="normal")

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

def on_loop_button_toggled(self):
self.loop = self.to_loop.get()
self.keep_playing = self.loop
if self.now_playing:
self.now_playing = self.loop
self.toggle_play_button_state()

Any command-line input or output is written as follows:

>>> import pyglet
>>> help(pyglet.media)

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "In our example, we will add menu items to the File, Edit, and About menu."

Warnings or important notes appear like this.
Tips and tricks appear like this.