Python Language tkinter


Released in Tkinter is Python's most popular GUI (Graphical User Interface) library. This topic explains proper usage of this library and its features.


The capitalization of the tkinter module is different between Python 2 and 3. For Python 2 use the following:

from Tkinter import *  # Capitalized

For Python 3 use the following:

from tkinter import *  # Lowercase

For code that works with both Python 2 and 3, you can either do

    from Tkinter import *
except ImportError:
    from tkinter import *


from sys import version_info
if version_info.major == 2:
    from Tkinter import *
elif version_info.major == 3:
    from tkinter import *

See the tkinter Documentation for more details