Reputation: 76
I have a script that uses tkinter and this is how I start:
import tkinter.messagebox
from tkinter import *
from tkinter.filedialog import askdirectory
from tkinter import ttk
I am mixing here both import and from..import. Is it ok? Is there another way so I do not mix them both?
Thanks
Upvotes: 0
Views: 1420
Reputation: 386372
most of the import statements aee ok, but you should change from tkinter import *
to import tkinter
or import tkinter as tk
. PEP8 suggests that global imports should be avoided, and that is good advice.
Upvotes: 1