Book Image

Tkinter GUI Application Development HOTSHOT

By : Bhaskar Chaudhary
Book Image

Tkinter GUI Application Development HOTSHOT

By: Bhaskar Chaudhary

Overview of this book

<p>Tkinter is the built-in GUI package that comes with standard python distributions. This means it is easy to get started right away, without any extra installation or configuration. Tkinter’s strength lies in its simplicity of use and its intuitive nature which makes it suited for programmers and non-programmers alike. Once you get started, you will be surprised to see how a few lines of code can produce powerful GUI applications.</p> <p>Tkinter GUI Application Development Hotshot helps you learn the art of GUI programming—building real-world, productive and fun applications like text editor, drum machine, game of chess, media player, drawing application and many more. Each subsequent project builds on the skills acquired in the previous project. Also, learn to write multi-threaded and multi layered applications using Tkinter. Get to know modern best practices involved in writing GUI programs. Tkinter GUI Application Development Hotshot comes with a rich source of sample codes that you can use in your own projects in any discipline of your choice.</p> <p>Starting with a high level overview of Tkinter that covers the most important concepts involved in writing a GUI application, the book then takes you through a series of real world projects of increasing complexity, developing one project per chapter. After you have developed five full projects, the book provides you with some bare-bone skeleton codes for a few functional but incomplete projects, challenging you to put your skills to test by completing them.</p> <p>Finally, you are provided with tips for writing reusable, scalable, and quality GUI code for larger projects. The appendices provide a quick reference sheet for Tkinter.</p>
Table of Contents (16 chapters)
Tkinter GUI Application Development HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Tkinter in Python 3.x


In 2008, Guido van Rossum, the author of Python, forked the language into two branches—2.x, and 3.x. This was done to clean up and make the language more consistent.

Python 3.x broke backward compatibility with the Python 2.x. For example, the print statement in Python 2.x was replaced by print() function that would now take arguments as parameters.

We coded all our Tkinter programs in Python Version 2.7, because it has a richer set of third-party libraries than Python 3.x, which is still considered a developing version.

The core functionality of Tkinter remains the same between 2.x, and 3.x. The only significant change to Tkinter when moving from Python 2.x to Python 3.x involves changing the way Tkinter modules are imported.

Tkinter has been renamed to tkinter in Python 3.x (capitalization has been removed). Note that in 3.x, the directory lib-tk was renamed to tkinter. Inside the directory, the file Tkinter.py was renamed to __init__.py, thus making tkinter an importable module.

Accordingly, the biggest major difference lies in the way you import the Tkinter module into your current namespace:

from Tkinter import *    # for Python2
from tkinter import *    # for Python3

Further, take a note of the following changes:

Python 2.x

Python 3.x

import ttk

import tkinter.ttk OR

from tkinter import ttk

import tkMessageBox

import tkinter.messagebox

import tkColorChooser

import tkinter.colorchooser

import tkFileDialog

import tkinter.filedialog

import tkSimpleDialog

import tkinter.simpledialog

import tkCommonDialog

import tkinter.commondialog

import tkFont

import tkinter.font

import ScrolledText

import tkinter.scrolledtext

import Tix

import tkinter.tix