Installing tkMessageBox on Python2.7

duhaime picture duhaime · Sep 29, 2013 · Viewed 11k times · Source

Does anyone happen to know how I can install tkMessageBox on Python2.7? I'm trying to run some Tkinter scripts that I've found, and I need the tkMessageBox to do so. I tried "pip install tkMessageBox" and got a message that said no package by that name could be found. I also tried looking on Christoph Gohlke's site for an installer, but no luck. I've read that tkMessageBox has changed names in Python3.x--can I pip install it by using a different name? Any help others can offer would be most appreciated. (In case it matters, I'm working in Windows 8.)

Answer

Bryan Oakley picture Bryan Oakley · Sep 29, 2013

It comes with Tkinter, it's not a separate package. If you have tkinter, you have tkmessagebox. However, it has been renamed in python 3

python 2.x:

import Tkinter
import tkMessageBox

python 3.x:

from tkinter import messagebox as tkMessageBox