Book Image

Tkinter GUI Programming by Example

Book Image

Tkinter GUI Programming by Example

Overview of this book

Tkinter is a modular, cross-platform application development toolkit for Python. When developing GUI-rich applications, the most important choices are which programming language(s) and which GUI framework to use. Python and Tkinter prove to be a great combination. This book will get you familiar with Tkinter by having you create fun and interactive projects. These projects have varying degrees of complexity. We'll start with a simple project, where you'll learn the fundamentals of GUI programming and the basics of working with a Tkinter application. After getting the basics right, we'll move on to creating a project of slightly increased complexity, such as a highly customizable Python editor. In the next project, we'll crank up the complexity level to create an instant messaging app. Toward the end, we'll discuss various ways of packaging our applications so that they can be shared and installed on other machines without the user having to learn how to install and run Python programs.
Table of Contents (18 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Summary


With the completion of this chapter, we now have a fully graphical version of a game which was previously playable only over the command line. We have identified the key decisions to make before porting the interface of a command-line application over to a graphical one.

The benefits of making programs follow a reusable, class-based data structure have been made clear during the upgrading of our interface, allowing for a lot of code reuse between the previous chapter and this one.

We have learned about the drawing abilities of Tkinter's Canvas widget—we practiced drawing natively via lines and polygons, as well as inserting an image file at certain coordinates.

More detailed controls of the pack geometry manager have been shown, including the use of pack_propagate(0) to keep a Frame at its defined size and pack_forget to replace widgets with others.

While impressive, our blackjack game is not quite complete yet. We will be adding the ability to bet money and continue playing until we...