mtTkinter is a module that provides thread-safety for Tkinter under Python 2.7. You can check the Wiki on the GitHub repository to learn more about how to install mtTkinter and how to use it.
Below you will find a copy of this Wiki made on 02-03-2017.

mtTkinter

Welcome to the help page of mtTkinter! mtTkinter is a thread-safe wrapper around Tkinter in Python. This module is only useful for Python 2.x installations, as in Python 3 Tkinter is compiled with a flag that ensures thread-safety. This module was written by Allen B. Taylor, and is only redistributed by me for anyone who finds it useful.

Installation

You can install mtTkinter in two ways. If you are on Python 2.7, you can install the PyPI-package by executing pip install mttkinter, this is the preferred method. This will automatically download and install mtTkinter, and you can then import the module as follows:

from mttkinter import mtTkinter as tk

If you are using the legacy Python 2.6 or an even older version, you can copy the mtTkinter.py directly into %PYTHON%/Libs/lib-tk in order to import it as follows:

import mtTkinter as tk

Support for Python 2.6 or lower is not tested and is not guaranteed.

Usage

Because mtTkinter.py contains the following import from Tkinter import *, you can use every Tkinter widget and variable just as you normally would. Only changing the import to mtTkinter is enough to make your application work with a thread-safe UI. The mtTkinter Tk-class, which is really the only modified class in the whole module, uses a Queue.Queue object to take event calls. The modified Tk-class has two additional keyword arguments:

Development

Currently, this module is not under active development. You can fork the repository if you want, under the LGPL License and either redistribute it yourself or, if you want your additions to be added to the PyPI package mttkinter, you can create a Pull Request to get your changes into the master branch of this repository.