-3

I am learning tkinter and noticed that people import multiple things sometimes.

from tkinter import *
from tkinter import ttk

I was wondering why people do this for many modules, not just tkinter. I always thought that import * meant that you were importing everything from a module. So why do people import more items?

PokeBros
  • 51
  • 1
  • 2
  • 7

1 Answers1

1

tkinter.ttk is a submodule of tkinter. Submodules aren't guaranteed to be loaded by import *; if you want them, it's safest to import them yourself. (Whether submodules are loaded by import * depends on the presence and contents of an __all__ list, as well as what imports __init__.py performs and what imports have already been performed.)

user2357112
  • 260,549
  • 28
  • 431
  • 505