Home > database >  Python Tkinter import all
Python Tkinter import all

Time:11-12

I keep getting a warning in my code editor "Wildcard import from a library not allowed" does anyone know how to fix this error?

from tkinter import *

this is the warning I get (Wildcard import from a library not allowed)

CodePudding user response:

When you use a wildcard import, every function and variable from the library is "put" into your code. This can cause unexpected issues, like accidentally writing a variable from tkinter.

Instead, you should import tkinter as tk and put tk.<widget name> for anything you want to put in a window.

  • Related