tkinter.messagebox.showinfo doesn't always work
messagebox
, along with some other modules like filedialog
, does not automatically get imported when you import tkinter
. Import it explicitly, using as
and/or from
as desired.
>>> import tkinter
>>> tkinter.messagebox.showinfo(message='hi')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'messagebox'
>>> import tkinter.messagebox
>>> tkinter.messagebox.showinfo(message='hi')
'ok'
>>> from tkinter import messagebox
>>> messagebox.showinfo(message='hi')
'ok'