Book Image

Tkinter GUI Application Development Blueprints

By : Bhaskar Chaudhary
Book Image

Tkinter GUI Application Development Blueprints

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, media player, drawing application, chat application, screen saver, port scanner, and many 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 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 (15 chapters)
Tkinter GUI Application Development Blueprints
About the Author
About the Reviewers

Drawing items on the canvas

Objects added to the canvas are called items. New items are added to the canvas using different create methods like create_line, create_arc, create_oval, create_rectangle, create_polygon, create_text, create_bitmap, and create_image.

Items added to the canvas are placed in a stack. New items are added on top of items already on the canvas. Every time you add an item using one of the various create methods, it returns a unique item handle or an item id that is a unique integer. This item handle can be used to refer to and manipulate the added item. In addition to an item handle, items can have the following item specifiers:

  • tags are specifiers that we can add to one or more items

  • ALL (or the string all) matches all items on the canvas

  • CURRENT (or current) matches the item under the mouse pointer, if any

We can use any of the preceding item specifiers for methods that act on canvas items.

To add a tag to an item, you specify the tag (which is a string) as its configurable...