“variable” May be undefined or defined from star imports: tkinter

后端 未结 2 956
醉话见心
醉话见心 2020-12-18 13:51

I\'m trying to make a simple outline for a gui, and I\'m getting the warning \"variable\" May be undefined or defined from star imports: tkinter for all of my variables.

相关标签:
2条回答
  • 2020-12-18 14:04

    Consider using:

    import tkinter as tk
    

    and then, prefix all your calls like:

    root = tk.Tk()
    

    or,

    variableName.pack(side = tk.LEFT)
    

    and so on...

    0 讨论(0)
  • 2020-12-18 14:22

    from tkinter import *

    In this line, you import everything from tkinter. This is not recommended, so linter will warn you. But if you really want to do this, it's OK, just ignore it.

    To be better, you should explicitly import what you need. For example:

    from tkinter import Tk, Label, Frame, Entry, Button
    
    0 讨论(0)
提交回复
热议问题