Vitalynx
Vitalynx

Reputation: 984

Why do i need to import messagebox in python?

When you have this code already:

from tkinter import *

Assuming that this code means that it imports everything from the tkinter module, why doesn't it import tkinter messagebox. I'd have to use this seperate code for it to work:

from tkinter import messagebox

Upvotes: -1

Views: 887

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385960

That's simply the way the package was designed to work. The author of tkinter decided that importing "*" wouldn't import messagebox, or some of the other packages (ttk is another example)

Generally speaking, you should never do import * anyway.

Upvotes: 2

Related Questions